In order to grasp this concept, it is important to note that the HTML5 specification outlines two syntaxes: the standard HTML syntax for pages served as text/html
, and the XHTML syntax for pages served as application/xhtml+xml
. The browser reacts differently based on which syntax is utilized.
If your focus is on the text/html
syntax, then refer to section 8 - The HTML syntax within the spec.
To further understand, delve into the tree construction phase of the parser algorithm. Specifically, consider the scenario where the <noscript>
element exists in the head section by examining The "in head" insertion mode. Here, you will encounter
A start tag whose tag name is "noscript, if the scripting flag is enabled
, leading to the
generic raw text element parsing algorithm.
This action places the tokenizer in a RAWTEXT state, allowing all characters to simply pass through until the </noscript>
tag is detected (meaning entity references remain unresolved). Subsequently, the insertion mode switches to The "text" insertion mode.
The process involves appending each character to a text node until the closing </noscript>
tag is encountered. Once found, the insertion mode reverts back to its previous state (e.g., the "in head" insertion mode), signifying the completion of parsing for the <noscript>
element.
As a result of this sequence, the snippet
<link rel="stylesheet" href="basic.css" type="text/css" media="all" />
will exist as untouched content within a text node serving as the only child of the
<noscript>
element.