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

Side by Side Diff: LayoutTests/fast/dom/shadow/get-distributed-nodes-orphan.html

Issue 133213008: Either content elements or shadow elements should not be treated as insertion points if they are no… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/dom/shadow/get-distributed-nodes-orphan-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 <script src="resources/shadow-dom.js"></script> 5 <script src="resources/shadow-dom.js"></script>
6 </head> 6 </head>
7 <body> 7 <body>
8 8
9 <div id="container"></div> 9 <div id="container"></div>
10 <pre id="console"></pre> 10 <pre id="console"></pre>
11 11
12 <script> 12 <script>
13 description("getDistributedNodes() should work out of Document"); 13 description("getDistributedNodes() shouldn't work unless it is inDocument");
14 14
15 function assertNodeList(nodeList, expectedNodes) 15 function assertNodeList(nodeList, expectedNodes)
16 { 16 {
17 window.nodeList = nodeList; 17 window.nodeList = nodeList;
18 window.expectedNodes = expectedNodes; 18 window.expectedNodes = expectedNodes;
19 shouldBe("nodeList.length", "expectedNodes.length"); 19 shouldBe("nodeList.length", "expectedNodes.length");
20 for (var i = 0; i < nodeList.length; ++i) { 20 for (var i = 0; i < nodeList.length; ++i) {
21 shouldBe("nodeList.item(" + i + ")", "expectedNodes[" + i + "]"); 21 shouldBe("nodeList.item(" + i + ")", "expectedNodes[" + i + "]");
22 } 22 }
23 } 23 }
24 24
25 var host = document.createElement('div'); 25 var host = document.createElement('div');
26 var shadowRoot = host.createShadowRoot(); 26 var shadowRoot = host.createShadowRoot();
27 var child = document.createElement('div'); 27 var child = document.createElement('div');
28 var rootChild = document.createElement('div'); 28 var rootChild = document.createElement('div');
29 var content = document.createElement('content'); 29 var content = document.createElement('content');
30 30
31 host.appendChild(child); 31 host.appendChild(child);
32 rootChild.appendChild(content); 32 rootChild.appendChild(content);
33 shadowRoot.appendChild(rootChild); 33 shadowRoot.appendChild(rootChild);
34 34
35 debug('getDistributedNodes() should work out of Document');
36 assertNodeList(content.getDistributedNodes(), [child]);
37 debug('');
38
39 debug('When a content element is disconnected from ShadowRoot, it should not wor k.');
40 shadowRoot.removeChild(rootChild);
41 assertNodeList(content.getDistributedNodes(), []); 35 assertNodeList(content.getDistributedNodes(), []);
42 debug(''); 36 debug('');
43
44 debug('Reprojection case');
45 shadowRoot.appendChild(rootChild);
46 var shadowRoot2 = rootChild.createShadowRoot();
47 var content2 = document.createElement('content');
48 var rootChildChild = document.createElement('div');
49 shadowRoot2.appendChild(content2);
50 rootChild.appendChild(rootChildChild);
51
52 assertNodeList(content.getDistributedNodes(), [child]);
53 assertNodeList(content2.getDistributedNodes(), [child, rootChildChild]);
54 debug('');
55
56 debug('rootChild is disconnected. Now content became inactive, so content elemen t itself should be distributed.');
57 shadowRoot.removeChild(rootChild);
58 assertNodeList(content.getDistributedNodes(), []);
59 assertNodeList(content2.getDistributedNodes(), [content, rootChildChild]);
60 debug('');
61 </script> 37 </script>
62 </body> 38 </body>
63 </html> 39 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/shadow/get-distributed-nodes-orphan-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698