Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/dom/Node/treeRoot.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/dom/Node/treeRoot.html b/third_party/WebKit/LayoutTests/fast/dom/Node/treeRoot.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a9f0e07b2f384b5a2f1e3f25eddaf4239c7350e3 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/dom/Node/treeRoot.html |
| @@ -0,0 +1,37 @@ |
| +<!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.
|
| +<script src="../../../resources/testharness.js"></script> |
| +<script src="../../../resources/testharnessreport.js"></script> |
| +<div id="host-parent"> |
| + <div id="host"> |
| + </div> |
| +</div> |
| +<script> |
| +var hostParent = document.getElementById('host-parent'); |
| +var host = document.getElementById('host'); |
| +var root = host.attachShadow({mode: 'open'}); |
| +var child = document.createElement('div'); |
| +var grandchild = document.createElement('div'); |
| +child.setAttribute('id', 'child'); |
| +grandchild.setAttribute('id', 'grandchild'); |
| +root.appendChild(child); |
| +child.appendChild(grandchild); |
| + |
| +var detached = document.createElement('div'); |
| +var detachedChild = document.createElement('div'); |
| +detached.appendChild(detachedChild); |
| + |
| +test(function() { |
| + assert_equals(document.treeRoot, document); |
| + assert_equals(hostParent.treeRoot, document); |
| + assert_equals(host.treeRoot, document); |
| + assert_equals(root.treeRoot, root); |
| + assert_equals(child.treeRoot, root); |
| + assert_equals(grandchild.treeRoot, root); |
| +}, 'Node.treeRoot returns a root of the tree that the node belongs to, or the shadow root if the tree is a shadow tree.'); |
| + |
| +test(function() { |
| + assert_equals(detached.treeRoot, detached); |
| + assert_equals(detachedChild.treeRoot, detached); |
| +}, 'Node.treeRoot works with a detached tree as well.'); |
| + |
|
kochi
2016/01/28 06:46:11
Even though we guard using "ShadowDOMV1" runtime f
yuzuchan
2016/02/01 04:59:54
Done.
|
| +</script> |