3 ms·
Show HN: Mysterious bug in the HTML spec
- andrew-lucker 9y agoSome 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.
- judofyr 9y agoIt's certainly valid to have some tags inside <b>. How else would you have bold and italic text? I thought you could have all types of tags inside <b>, but it seems something weird happens once you stack more tags of the same type?
- somebee 9y agoAll phrasing content is permitted inside <b>, including <em>. See https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Cont...
- andrew-lucker 9y agoKeyword 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 9y agois this really something you want to show on hackernews ? why not asking stackoverflow community for this ?