Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/Node/treeRoot.html

Issue 1642503002: Implement Node.treeRoot (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add if case for detached tree Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698