4 ms·
replying to myself like a pro: after reading the spec https://www.w3.org/TR/html5/scripting-1.html#the-noscript-element https://www.w3.org/TR/html5/scripting-1.
by franze 10y ago
replying to myself like a pro: after reading the spec https://www.w3.org/TR/html5/scripting-1.html#the-noscript-element https://www.w3.org/TR/html5/scripting-1.html#the-noscript-el..., the <noscript> element is even trickier, it has at least 4 parsing modes:
in the head with scripting disabled (no text, only link, style, meta)
in the head, with scripting enabled (can include text (like whitespaces) but parsed elements must result in link,style,meta DOM only)
in the body with scripting disabled (text, but no other noscript)
in the body with scripting enabled (text, but no other noscript and script tags)
so basically
<html><noscript><link href="e.css"></noscript><title>hi</title><h1>ho</h1>
would be find, as the <head> would close just before the <h1> (in scripting enabled and disabled case)
but:
<html><noscript> <link href="e.css"></noscript><title>hi</title><h1>ho</h1>
would close the <head> in a scripting disabled case just before the <noscript>-tag
and closes the <head> just before the <h1> in a scripting enabled case.
this would explain the DOMParser.parseFromString() behaviour, as it's a scripting disabled case....
- zcorpan 10y agohttp://software.hixie.ch/utilities/js/live-dom-viewer/saved/4486 http://software.hixie.ch/utilities/js/live-dom-viewer/saved/... In Chrome Canary 55.0.2866.0 the noscript element contains a text node and a link element. This matches the spec as far as I can tell; whitespace is allowed in noscript in head.