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

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: 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..e063baa05cf88e6718657e50eef998845bbbafe5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/Node/treeRoot.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
kochi 2016/01/27 09:18:49 You can omit <html><head><body> (and their closing
yuzuchan 2016/01/28 06:23:56 Done.
+<head>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+</head>
+<body>
+This test case verifies if Node.treeRoot works as expected.
+<div id='host-parent'>
kochi 2016/01/27 09:18:49 Please use consistent quotes as in other places. D
yuzuchan 2016/01/28 06:23:56 On 2016/01/27 09:18:49, kochi wrote: > Please use
+ <div id='host'>
+ </div>
+</div>
+<script>
+
+var hostParent = document.getElementById('host-parent');
+var host = document.getElementById('host');
+host.attachShadow({mode: 'open'});
+var root = host.shadowRoot;
kochi 2016/01/27 09:18:49 You can merge the 2 lines above, as var root = hos
yuzuchan 2016/01/28 06:23:56 Done.
+var child = document.createElement('div');
+var grandchild = document.createElement('div');
+child.setAttribute('id', 'child');
+grandchild.setAttribute('id', 'grandchild');
+root.appendChild(child);
+child.appendChild(grandchild);
+
+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.");
kochi 2016/01/27 09:18:49 Use single quotes.
yuzuchan 2016/01/28 06:23:56 Done.
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Node.h » ('j') | third_party/WebKit/Source/core/dom/Node.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698