Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser unexpected behavior on value-less attribute #6259

Closed
pushkine opened this issue Apr 29, 2021 · 3 comments · Fixed by #6612
Closed

Parser unexpected behavior on value-less attribute #6259

pushkine opened this issue Apr 29, 2021 · 3 comments · Fixed by #6612

Comments

@pushkine
Copy link
Contributor

pushkine commented Apr 29, 2021

https://astexplorer.net/#/gist/2bbf556514bd54e799f8b9c836f6b7c9/3896519c24f22c47c49059def15ffed41c709c82

<div foo= ></div>
{
  "start": 5,
  "end": 10,
  "type": "Attribute",
  "name": "foo",
  "value": []
}

Unexpected "value": [], value is undefined.
Expected either Parser Error or "value": true (html behavior)

@pngwn
Copy link
Member

pngwn commented Apr 29, 2021

While browsers will repair this, it is invalid. I think this should be a parser error.

@unlocomqx
Copy link

It's invalid html according to W3C Validator

Error: Attribute value missing.

@Conduitry
Copy link
Member

The parser returns a more helpful "Expected value for the attribute (1:10)" error now in 3.42.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants