Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse noscript children as nodes when runScripts is not "dangerously"
Fixes #1611.
- Loading branch information
Showing
3 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
test/web-platform-tests/to-upstream/html/syntax/parsing/noscript-template-querySelector.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>querySelector on template fragments with noscript elements</title> | ||
|
||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<template id="template1"><noscript><div></div></noscript></template> | ||
<template id="template2"><noscript><div id="noScriptContent"></div></noscript></template> | ||
|
||
<script> | ||
"use strict"; | ||
test(() => { | ||
const fragment = document.querySelector("#template1").content; | ||
const noscriptNode = fragment.querySelector("noscript"); | ||
|
||
assert_equals(noscriptNode.childNodes[0].nodeType, Node.TEXT_NODE, "Is a text node"); | ||
assert_equals(noscriptNode.innerHTML, "<div></div>"); | ||
}, "noscript child should be text node."); | ||
|
||
test(() => { | ||
const fragment = document.querySelector("#template2").content; | ||
const noscriptChildNode = fragment.querySelector("#noScriptContent"); | ||
assert_equals(noscriptChildNode, null); | ||
}, "noscript child should be unreachable"); | ||
</script> |