Re:Google HTML/CSS Style Guide – Omit Optional Tags
by franze on Saturday September 17, 2016 @01:12PM
(#12521337)
replying to myself like a pro: after reading the spec 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>-tagand 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....
Re:Google HTML/CSS Style Guide – Omit Optional Tags
by zcorpan on Tuesday September 20, 2016 @08:27AM
(#12538937)
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.
namely, the always beloved <noscript> tag https://developer.mozilla.org/en/docs/Web/HTML/Element/noscr...
which is a flow content element in the body section
but if used in the <head> it might include links, style and meta-tags and then it should not be treated as content element.
as the <head> element therefore changes the behavior of its child-elements, does this make it non optional?
p.s.: i think DOMParser.parseFromString() in Chrome gets this <noscript> behaviour wrong in some cases (closes the <head>-section as it treats the <noscript>-tag as content-element, even though it is in the <head> with just links & style children, so it shoudn't close the <head>...)