-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Serialize the children of void elements as the empty string #4238
Conversation
This is consistent with the current implementations in Chrome and Safari.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we put VOIDLIST in a variable, so we only have to enumerate it once in this algorithm? (FWIW, I checked, only this algorithm makes use of it within HTML and I suspect that means everywhere.) Looks good otherwise, appreciate the algorithm prose cleanup too.
Do you also want to file a bug against Firefox? |
@annevk Variable added. Here's the Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1514499 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with one suggested change.
I wrote this commit message:
But realized that you don't seem to be in the acknowledgments, @Zirro. Would you like to add yourself? |
Thank you for asking, but I'm actually listed there under my real name after a previous contribution. |
Ah thanks! I think my Ctrl+F was malfunctioning... |
Beautiful! |
Proposed solution to #4220, which makes the algorithm consistent with the current implementations in Chrome and Safari. The intention is for the innerHTML of void elements to return the empty string even in cases where child nodes are present. I changed the steps to explicitly return a value in two locations as it made most sense for this change.
There are tests for this in https://wpt.fyi/results/html/syntax/serializing-html-fragments/serializing.html which previously disagreed with the specification. This change would align the specification with the tests.
/parsing.html ( diff )