3 <script src=
"../http/tests/inspector/inspector-test.js"></script>
8 InspectorTest
.runTestSuite([
9 function traverseNextNodeInShadowDom(next
)
11 function createContent(parent
, selection
)
13 var content
= parent
.createChild("content");
14 content
.setAttribute("select", selection
);
17 var component1
= createElementWithClass("div", "component1");
18 var oldShadow
= component1
.createShadowRoot();
19 var oldContent
= createElementWithClass("div", "shadow-old-content");
20 oldContent
.textContent
= "old content";
21 oldShadow
.appendChild(oldContent
);
22 var shadow1
= component1
.createShadowRoot();
23 component1
.createChild("div", "component1-content").textContent
= "text 1";
24 component1
.createChild("div", "component2-content").textContent
= "text 2";
25 component1
.createChild("span").textContent
= "text 3";
26 component1
.createChild("span", "component1-content").textContent
= "text 4";
28 var shadow1Content
= createElementWithClass("div", "shadow-component1");
29 shadow1
.appendChild(shadow1Content
);
30 createContent(shadow1Content
, ".component1-content");
31 createContent(shadow1Content
, "span");
33 var component2
= shadow1Content
.createChild("div", "component2");
34 var shadow2
= component2
.createShadowRoot();
35 createContent(component2
, ".component2-content");
36 component2
.createChild("div", "component2-content").textContent
= "component2 light dom text";
38 var shadow2Content
= createElementWithClass("div", "shadow-component1");
39 shadow2
.appendChild(shadow2Content
);
40 var midDiv
= shadow2Content
.createChild("div", "mid-div");
41 midDiv
.createChild("div").textContent
= "component2-text";
42 createContent(midDiv
, ".component2-content");
44 var node
= component1
;
45 while ((node
= node
.traverseNextNode(component1
))) {
46 if (node
.nodeType
=== Node
.TEXT_NODE
)
47 InspectorTest
.addResult(node
.nodeValue
);
49 InspectorTest
.addResult(node
.nodeName
+ (node
.className
? "." + node
.className
: ""));
59 <body onload=
"runTest()">
61 This test checks dom extensions.