OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
3 <script src="../../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
4 <div id="host-parent"> | 4 <div id="host-parent"> |
5 <div id="host"> | 5 <div id="host"> |
6 </div> | 6 </div> |
7 <div id="slotted"></div> | 7 <div id="slotted"></div> |
8 </div> | 8 </div> |
9 <div id="host-parent2"> | 9 <div id="host-parent2"> |
10 <div id="host2"> | 10 <div id="host2"> |
(...skipping 11 matching lines...) Expand all Loading... |
22 var slot = document.createElement('slot'); | 22 var slot = document.createElement('slot'); |
23 slot.setAttribute('name', 'slot'); | 23 slot.setAttribute('name', 'slot'); |
24 slotted.setAttribute('slot', 'slot'); | 24 slotted.setAttribute('slot', 'slot'); |
25 child.setAttribute('id', 'child'); | 25 child.setAttribute('id', 'child'); |
26 grandchild.setAttribute('id', 'grandchild'); | 26 grandchild.setAttribute('id', 'grandchild'); |
27 root.appendChild(child); | 27 root.appendChild(child); |
28 child.appendChild(grandchild); | 28 child.appendChild(grandchild); |
29 grandchild.appendChild(slot); | 29 grandchild.appendChild(slot); |
30 | 30 |
31 test(function() { | 31 test(function() { |
32 assert_equals(document.treeRoot, document); | 32 assert_equals(document.rootNode, document); |
33 assert_equals(hostParent.treeRoot, document); | 33 assert_equals(hostParent.rootNode, document); |
34 assert_equals(host.treeRoot, document); | 34 assert_equals(host.rootNode, document); |
35 assert_equals(root.treeRoot, root); | 35 assert_equals(root.rootNode, root); |
36 assert_equals(child.treeRoot, root); | 36 assert_equals(child.rootNode, root); |
37 assert_equals(grandchild.treeRoot, root); | 37 assert_equals(grandchild.rootNode, root); |
38 assert_equals(slot.treeRoot, root); | 38 assert_equals(slot.rootNode, root); |
39 assert_equals(slotted.treeRoot, document); | 39 assert_equals(slotted.rootNode, document); |
40 }, 'Node.treeRoot returns a root of the tree that the node belongs to, or the sh
adow root if the tree is a shadow tree.'); | 40 }, 'Node.rootNode returns a root of the tree that the node belongs to, or the sh
adow root if the tree is a shadow tree.'); |
41 | 41 |
42 test(function() { | 42 test(function() { |
43 var nestedChild = document.createElement('div'); | 43 var nestedChild = document.createElement('div'); |
44 var nestedRoot = grandchild.attachShadow({mode: 'open'}); | 44 var nestedRoot = grandchild.attachShadow({mode: 'open'}); |
45 nestedRoot.appendChild(nestedChild); | 45 nestedRoot.appendChild(nestedChild); |
46 | 46 |
47 assert_equals(nestedRoot.treeRoot, nestedRoot); | 47 assert_equals(nestedRoot.rootNode, nestedRoot); |
48 assert_equals(nestedChild.treeRoot, nestedRoot); | 48 assert_equals(nestedChild.rootNode, nestedRoot); |
49 }, 'Node.treeRoot works with a nested shadow tree.'); | 49 }, 'Node.rootNode works with a nested shadow tree.'); |
50 | 50 |
51 test(function() { | 51 test(function() { |
52 var detached = document.createElement('div'); | 52 var detached = document.createElement('div'); |
53 var detachedChild = document.createElement('div'); | 53 var detachedChild = document.createElement('div'); |
54 detached.appendChild(detachedChild); | 54 detached.appendChild(detachedChild); |
55 | 55 |
56 assert_equals(detached.treeRoot, detached); | 56 assert_equals(detached.rootNode, detached); |
57 assert_equals(detachedChild.treeRoot, detached); | 57 assert_equals(detachedChild.rootNode, detached); |
58 }, 'Node.treeRoot works with a detached tree as well.'); | 58 }, 'Node.rootNode works with a detached tree as well.'); |
59 | 59 |
60 test(function() { | 60 test(function() { |
61 var hostParent2 = document.getElementById('host-parent2'); | 61 var hostParent2 = document.getElementById('host-parent2'); |
62 var host2 = document.getElementById('host2'); | 62 var host2 = document.getElementById('host2'); |
63 var distributed = document.getElementById('distributed'); | 63 var distributed = document.getElementById('distributed'); |
64 var root2 = host2.createShadowRoot(); | 64 var root2 = host2.createShadowRoot(); |
65 var child2 = document.createElement('div'); | 65 var child2 = document.createElement('div'); |
66 var grandchild2 = document.createElement('div'); | 66 var grandchild2 = document.createElement('div'); |
67 var content = document.createElement('content'); | 67 var content = document.createElement('content'); |
68 content.setAttribute('select', '#distributed'); | 68 content.setAttribute('select', '#distributed'); |
69 child2.setAttribute('id', 'child2'); | 69 child2.setAttribute('id', 'child2'); |
70 grandchild2.setAttribute('id', 'grandchild2'); | 70 grandchild2.setAttribute('id', 'grandchild2'); |
71 root2.appendChild(child2); | 71 root2.appendChild(child2); |
72 child2.appendChild(grandchild2); | 72 child2.appendChild(grandchild2); |
73 grandchild2.appendChild(content); | 73 grandchild2.appendChild(content); |
74 | 74 |
75 assert_equals(hostParent2.treeRoot, document); | 75 assert_equals(hostParent2.rootNode, document); |
76 assert_equals(host2.treeRoot, document); | 76 assert_equals(host2.rootNode, document); |
77 assert_equals(root2.treeRoot, root2); | 77 assert_equals(root2.rootNode, root2); |
78 assert_equals(child2.treeRoot, root2); | 78 assert_equals(child2.rootNode, root2); |
79 assert_equals(grandchild2.treeRoot, root2); | 79 assert_equals(grandchild2.rootNode, root2); |
80 assert_equals(content.treeRoot, root2); | 80 assert_equals(content.rootNode, root2); |
81 assert_equals(distributed.treeRoot, document); | 81 assert_equals(distributed.rootNode, document); |
82 }, 'Node.treeRoot works with a v0 shadow tree as well.'); | 82 }, 'Node.rootNode works with a v0 shadow tree as well.'); |
83 | 83 |
84 </script> | 84 </script> |
OLD | NEW |