Serialize the children of void elements as the empty string#4238
Serialize the children of void elements as the empty string#4238domenic merged 4 commits intowhatwg:masterfrom
Conversation
This is consistent with the current implementations in Chrome and Safari.
annevk
left a comment
There was a problem hiding this comment.
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 |
Zirro
left a comment
There was a problem hiding this comment.
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 )