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

Side by Side 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, 10 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 unified diff | Download patch
OLDNEW
(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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698