mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Test DOM isolation for shadow trees
This commit is contained in:
parent
ffdc9d255f
commit
f3e707306f
3 changed files with 50 additions and 0 deletions
|
@ -13515,6 +13515,12 @@
|
||||||
{}
|
{}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
"mozilla/partial_shadow_dom.html": [
|
||||||
|
[
|
||||||
|
"mozilla/partial_shadow_dom.html",
|
||||||
|
{}
|
||||||
|
]
|
||||||
|
],
|
||||||
"mozilla/postmessage_closed.html": [
|
"mozilla/postmessage_closed.html": [
|
||||||
[
|
[
|
||||||
"mozilla/postmessage_closed.html",
|
"mozilla/postmessage_closed.html",
|
||||||
|
@ -20430,6 +20436,10 @@
|
||||||
"5aff666995fe6cd1d4e84e63a9f6019d04387f8e",
|
"5aff666995fe6cd1d4e84e63a9f6019d04387f8e",
|
||||||
"testharness"
|
"testharness"
|
||||||
],
|
],
|
||||||
|
"mozilla/partial_shadow_dom.html": [
|
||||||
|
"d97f1422d20161e989f200d44be6e379f79410bd",
|
||||||
|
"testharness"
|
||||||
|
],
|
||||||
"mozilla/poster.png": [
|
"mozilla/poster.png": [
|
||||||
"33834c3ef095fa9c0080017e1b65b2eb8413eac4",
|
"33834c3ef095fa9c0080017e1b65b2eb8413eac4",
|
||||||
"support"
|
"support"
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
[partial_shadow_dom.html]
|
||||||
|
prefs: [dom.shadowdom.enabled:true]
|
38
tests/wpt/mozilla/tests/mozilla/partial_shadow_dom.html
Normal file
38
tests/wpt/mozilla/tests/mozilla/partial_shadow_dom.html
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<!doctype html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title></title>
|
||||||
|
<script src="/resources/testharness.js"></script>
|
||||||
|
<script src="/resources/testharnessreport.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1 class="header">Not in the shadows</h1>
|
||||||
|
<div id="host">
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
test(function() {
|
||||||
|
// Attach shadow.
|
||||||
|
var host = document.getElementById('host');
|
||||||
|
var shadowRoot = host.attachShadow();
|
||||||
|
assert_not_equals(shadowRoot, null);
|
||||||
|
assert_equals(shadowRoot.host, host);
|
||||||
|
assert_equals(shadowRoot.mode, 'closed');
|
||||||
|
|
||||||
|
assert_equals(document.body.getElementsByTagName('h1').length, 1);
|
||||||
|
assert_equals(document.body.getElementsByClassName('header').length, 1);
|
||||||
|
assert_equals(document.querySelectorAll('h1').length, 1);
|
||||||
|
assert_equals(document.body.childNodes.length, 6);
|
||||||
|
|
||||||
|
// Append child to shadow tree and check that its content is encapsulated.
|
||||||
|
var shadowChild = document.createElement('h1');
|
||||||
|
shadowChild.classList.add('header');
|
||||||
|
shadowChild.textContent = 'In the shadows';
|
||||||
|
shadowRoot.appendChild(shadowChild);
|
||||||
|
assert_equals(document.body.getElementsByTagName('h1').length, 1);
|
||||||
|
assert_equals(document.body.getElementsByClassName('header').length, 1);
|
||||||
|
assert_equals(document.querySelectorAll('h1').length, 1);
|
||||||
|
assert_equals(document.body.childNodes.length, 6);
|
||||||
|
assert_equals(shadowRoot.querySelectorAll('h1').length, 1);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
Loading…
Add table
Add a link
Reference in a new issue