You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Apollo astronauts:</p><ul><li>Neil Armstrong</li><li>Alan Bean</li><li>Peter Conrad</li><li>Edgar Mitchell</li><li>Alan Shepard</li><script>/* something here */</script></ul>
Actual:
...
<li>Edgar Mitchell
<li>Alan Shepard
<script>/* child of alan now! */</script>
...
Expected:
The last </li> should be kept so that the script is still at the same level as other lis.
HTML standard allows both li, script and template inside a list, and
An li element's end tag can be omitted if the li element is immediately followed by another li element or if there is no more content in the parent element.
Found this edge case when dealing with non-standard HTML snippets with no ol or ul: the removal of </li> makes the rest part of content as child of last li 😂
The text was updated successfully, but these errors were encountered:
Googled several online minifiers and they all preserve the ending </li> no matter if it can be omitted - but that's kind of regression.
A hacky way is to keep </li>s first but add another pipeline later after removing white space, to remove </li> inside </li><li> | </li></ul> | </li></ol> | </li></menu> - sounds weird tho?
Input (modified from MDN)
Actual:
Expected:
The last
</li>
should be kept so that the script is still at the same level as otherli
s.HTML standard allows both
li
,script
andtemplate
inside a list, andFound this edge case when dealing with non-standard HTML snippets with no
ol
orul
: the removal of</li>
makes the rest part of content as child of lastli
😂The text was updated successfully, but these errors were encountered: