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

Value-free attributes? #181

Open
pcarrier opened this issue Nov 20, 2024 · 2 comments
Open

Value-free attributes? #181

pcarrier opened this issue Nov 20, 2024 · 2 comments

Comments

@pcarrier
Copy link

pcarrier commented Nov 20, 2024

Can't find a way to construct a node like <option selected> as opposed to <option selected="">. Is that an option I missed?

@pcarrier pcarrier changed the title Naked attributes? Value-free attributes? Nov 21, 2024
@b-fuze
Copy link
Owner

b-fuze commented Nov 21, 2024

deno-dom will try to follow the HTML standard, and HTML attributes must always have a value even if it's empty. The parser (just like any browser HTML parser) will parse them as a shorthand for attributes with an empty string value. Setting them from the DOM API will always require a string value even if that value is an empty string because that is what the HTML DOM API requires.

@pcarrier
Copy link
Author

pcarrier commented Nov 21, 2024

Thanks! I would love access to the shorthand when serializing to HTML. It does turn out to be lacking from browsers too though.

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

No branches or pull requests

2 participants