You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This flag determinate behaviour for noscript. Default scripting flag depends on scripting was enabled/disabled which depends if node's node document has a browsing context and scripting is enabled in that browsing context.
If needed then scripting flag can be force so we can have scripting flag set to "enabled" where scripting was disabled. Comment from HTML spec: "The scripting flag can be enabled even when the parser was originally created for the HTML fragment parsing algorithm, even though script elements don't execute in that case." HTML fragment parsing algorithm only check scripting flag state (doesn't change it).
And now in P&S I see:
all commands that use fragment parsing algorithm (Element.innerHTML, Element.outerHTML, Element.insertAdjacentHTML, Range.createContextualFragment) don't set explicity a scripting flag. They operate on intermediate document without browsing context so this flag has default state "disabled" so noscript element should be parsed. But browsers don't do this so probably somewhere this flag should be set to "enabled" in P&S spec.
for DOMParser.parseFromString() and "text/html" you wrote "The scripting flag must be set to "disabled" but it's obvious because returned document doesn't have browsing context and second green box inform about parsing noscript element.
Some test:
<scripttype="text/javascript">
var div = document.createElement("div");
div.innerHTML = "<noscript><p>test1<p>test2</noscript></noscript>";
console.log(div.firstChild.childNodes.length, div.firstChild.firstChild); // 1 text
var div2 = document.createElement("div");
div2.insertAdjacentHTML("afterbegin", "<noscript><p>test1<p>test2</noscript>");
console.log(div2.firstChild.childNodes.length, div.firstChild.firstChild); // 1 text
var frag = document.createRange().createContextualFragment("<noscript><p>test1<p>test2</noscript>");
console.log(frag.firstChild.childNodes.length, frag.firstChild.firstChild); // 1 text
var doc = new DOMParser().parseFromString("<body><noscript><p>test1<p>test2</noscript>", "text/html");
console.log(doc.body.firstChild.childNodes.length, doc.body.firstChild.firstChild, doc.body.firstChild.lastChild); // 2 p p
console.log(doc.defaultView); // null - this new document is without browsing context
</script>
The text was updated successfully, but these errors were encountered:
whatwg/html#5190 takes care of your second point by removing the note about the scripting flag and instead noting that there's no browsing context so scripting is disabled. I will also add tests to web-platform-tests/wpt#21041 if they don't exist already, for DOMParser.
The other part of the issue will wait until we move those APIs into HTML, but it's possible that could be soon.
domenic
added a commit
to web-platform-tests/wpt
that referenced
this issue
Jan 5, 2020
This flag determinate behaviour for noscript. Default scripting flag depends on scripting was enabled/disabled which depends if node's node document has a browsing context and scripting is enabled in that browsing context.
If needed then scripting flag can be force so we can have scripting flag set to "enabled" where scripting was disabled. Comment from HTML spec: "The scripting flag can be enabled even when the parser was originally created for the HTML fragment parsing algorithm, even though script elements don't execute in that case."
HTML fragment parsing algorithm only check scripting flag state (doesn't change it).
And now in P&S I see:
Element.innerHTML
,Element.outerHTML
,Element.insertAdjacentHTML
,Range.createContextualFragment
) don't set explicity a scripting flag. They operate on intermediate document without browsing context so this flag has default state "disabled" so noscript element should be parsed. But browsers don't do this so probably somewhere this flag should be set to "enabled" in P&S spec.DOMParser.parseFromString()
and"text/html"
you wrote "The scripting flag must be set to"disabled"
but it's obvious because returned document doesn't have browsing context and second green box inform about parsing noscript element.Some test:
The text was updated successfully, but these errors were encountered: