Closed sgkoishi closed 2 years ago
That sounds like quite the corner case. :o
I don't plan to fix this considering how much of a corner case it is but feel free to send a PR. :)
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?
That sounds very weird... HTML spec overall is quite the nightmare.
True, give up. Gonna fix my malformed input data magically 😀
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 bothli
,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
😂