
Show HN: Mysterious bug in the HTML spec - somebee
https://scrimba.com/c/cJg6nHW
======
andrew-lucker
Some html elements are containers, others aren't. <b> can only contain text,
so there is a bunch of ignored <b>'s and </b>'s. Then comes the <em> which is
followed by an unexpected closing </b>. Use div's or span's if you want to put
something inside and have nesting work normally.

~~~
somebee
All phrasing content is permitted inside <b>, including <em>. See
[https://developer.mozilla.org/en-
US/docs/Web/Guide/HTML/Cont...](https://developer.mozilla.org/en-
US/docs/Web/Guide/HTML/Content_categories#Phrasing_content)

~~~
andrew-lucker
Keyword there I think is "runs of phrasing content". That means that you can
"nest" different tags but not those of the same tag. The nesting <b> inside
<b> like op is causing the parser to ignore the depth of nesting of <b>
elements and just closes the bold content on first </b>.

------
lozzo
is this really something you want to show on hackernews ? why not asking
stackoverflow community for this ?

