Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
|
kochi
2016/01/28 06:46:11
Usually we have used fast/dom/shadow for any shado
yuzuchan
2016/02/01 04:59:54
Done.
| |
| 2 <script src="../../../resources/testharness.js"></script> | |
| 3 <script src="../../../resources/testharnessreport.js"></script> | |
| 4 <div id="host-parent"> | |
| 5 <div id="host"> | |
| 6 </div> | |
| 7 </div> | |
| 8 <script> | |
| 9 var hostParent = document.getElementById('host-parent'); | |
| 10 var host = document.getElementById('host'); | |
| 11 var root = host.attachShadow({mode: 'open'}); | |
| 12 var child = document.createElement('div'); | |
| 13 var grandchild = document.createElement('div'); | |
| 14 child.setAttribute('id', 'child'); | |
| 15 grandchild.setAttribute('id', 'grandchild'); | |
| 16 root.appendChild(child); | |
| 17 child.appendChild(grandchild); | |
| 18 | |
| 19 var detached = document.createElement('div'); | |
| 20 var detachedChild = document.createElement('div'); | |
| 21 detached.appendChild(detachedChild); | |
| 22 | |
| 23 test(function() { | |
| 24 assert_equals(document.treeRoot, document); | |
| 25 assert_equals(hostParent.treeRoot, document); | |
| 26 assert_equals(host.treeRoot, document); | |
| 27 assert_equals(root.treeRoot, root); | |
| 28 assert_equals(child.treeRoot, root); | |
| 29 assert_equals(grandchild.treeRoot, root); | |
| 30 }, '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.'); | |
| 31 | |
| 32 test(function() { | |
| 33 assert_equals(detached.treeRoot, detached); | |
| 34 assert_equals(detachedChild.treeRoot, detached); | |
| 35 }, 'Node.treeRoot works with a detached tree as well.'); | |
| 36 | |
|
kochi
2016/01/28 06:46:11
Even though we guard using "ShadowDOMV1" runtime f
yuzuchan
2016/02/01 04:59:54
Done.
| |
| 37 </script> | |
| OLD | NEW |