An attribute as written, before the parser knows its namespace.
name is ASCII-lowercased, which is right for HTML and wrong for SVG --viewBox arrives here as viewbox. Restoring it needs the namespace, whichneeds the element stack, which is the parser's. Doing it here would meanlowercasing and then un-lowercasing, or not lowercasing and getting HTMLwrong; doing it there is one table lookup at the point where the answer isknown.
Ordinary markup, almost always. The other two exist because the contentmodel of an element is decided by the element that opened it, and a scan canbegin already INSIDE one -- innerHTML on a <title>, a fragment handed toa template engine, a conformance suite naming an initial state. The tag iscarried rather than the state, because what ends a raw-text run is thatelement's own end tag and nothing else.
Whether this token is whitespace-only character data.
Asked by the parser at exactly one place -- deciding whether text before<html> is worth keeping -- and by tests. A method rather than a freefunction so that it reads as a property of the token.
A semantic markup tree for MoonBit: HTML, SVG and MathML, with a tolerant parser, a printer with pretty, compact and minified modes, and structured diagnostics