Why do browsers still inject in HTML5?

The answer of “backwards compatiblity” makes absolutely zero sense
because I specifically opted in for a HTML5 doctype.

However, browsers don’t differentiate between versions of HTML. HTML documents with HTML5 doctype and with HTML4 doctype (with the small exception of HTML4 transitional doctype without URL in FPI) are parsed and rendered the same way.

I’ll quote the relevant part of HTML5 parser description:

8.2.5.4.9 The “in table” insertion mode

A start tag whose tag name is one of: “td”, “th”, “tr”

Act as if a start tag token with the tag name “tbody” had been
seen, then reprocess the current token.

Leave a Comment