OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <style> | 4 <style> |
5 /* relative positioning ensures underlying RenderLayer */ | 5 /* relative positioning ensures underlying RenderLayer */ |
6 .container { | 6 .container { |
7 position: relative; | 7 position: relative; |
8 } | 8 } |
9 | 9 |
10 .span { | 10 .span { |
(...skipping 14 matching lines...) Expand all Loading... |
25 root.appendChild(createSpanWithText('AFTER')); | 25 root.appendChild(createSpanWithText('AFTER')); |
26 | 26 |
27 var sr = root.createShadowRoot(); | 27 var sr = root.createShadowRoot(); |
28 sr.appendChild(createSpanWithText('BEFORE')); | 28 sr.appendChild(createSpanWithText('BEFORE')); |
29 sr.appendChild(createSpanWithText('MID')); | 29 sr.appendChild(createSpanWithText('MID')); |
30 | 30 |
31 document.getElementById('actual-container').appendChild(root); | 31 document.getElementById('actual-container').appendChild(root); |
32 | 32 |
33 var f = (function(callIfDone, root, sr) { return function() { | 33 var f = (function(callIfDone, root, sr) { return function() { |
34 var shadow = document.createElement('shadow'); | 34 var shadow = document.createElement('shadow'); |
35 shadow.appendChild(document.createElement('content')); | |
36 sr.appendChild(shadow); | 35 sr.appendChild(shadow); |
37 callIfDone(); | 36 callIfDone(); |
38 }})(callIfDone, root, sr); | 37 }})(callIfDone, root, sr); |
39 | 38 |
40 setTimeout(f, 0); | 39 setTimeout(f, 0); |
41 }); | 40 }); |
42 | 41 |
43 testFuncs.push(function renderingShadowElementDynamicallyRemoved(callIfDone) { | 42 testFuncs.push(function renderingShadowElementDynamicallyRemoved(callIfDone) { |
44 document.getElementById('expect-container').innerHTML = | 43 document.getElementById('expect-container').innerHTML = |
45 "<div><span>BEFORE</span><span>AFTER</span></div>" | 44 "<div><span>BEFORE</span><span>AFTER</span></div>" |
46 | 45 |
47 var root = document.createElement('div'); | 46 var root = document.createElement('div'); |
48 root.appendChild(createSpanWithText('SHOULD NOT BE RENDERED')); | 47 root.appendChild(createSpanWithText('SHOULD NOT BE RENDERED')); |
49 | 48 |
50 var shadow = document.createElement('shadow'); | 49 var shadow = document.createElement('shadow'); |
51 shadow.appendChild(document.createElement('content')); | |
52 | 50 |
53 var sr = root.createShadowRoot(); | 51 var sr = root.createShadowRoot(); |
54 sr.appendChild(createSpanWithText('BEFORE')); | 52 sr.appendChild(createSpanWithText('BEFORE')); |
55 sr.appendChild(shadow); | 53 sr.appendChild(shadow); |
56 sr.appendChild(createSpanWithText('AFTER')); | 54 sr.appendChild(createSpanWithText('AFTER')); |
57 | 55 |
58 document.getElementById('actual-container').appendChild(root); | 56 document.getElementById('actual-container').appendChild(root); |
59 | 57 |
60 var f = (function(callIfDone, sr, shadow) { return function() { | 58 var f = (function(callIfDone, sr, shadow) { return function() { |
61 sr.removeChild(shadow); | 59 sr.removeChild(shadow); |
62 callIfDone(); | 60 callIfDone(); |
63 }})(callIfDone, sr, shadow); | 61 }})(callIfDone, sr, shadow); |
64 | 62 |
65 setTimeout(f, 0); | 63 setTimeout(f, 0); |
66 }); | 64 }); |
67 | 65 |
68 testFuncs.push(function renderingLightChildrenDynamicallyAdded(callIfDone) { | 66 testFuncs.push(function renderingLightChildrenDynamicallyAdded(callIfDone) { |
69 document.getElementById('expect-container').innerHTML = | 67 document.getElementById('expect-container').innerHTML = |
70 "<div><span>BEFORE</span><span>MID</span><span>AFTER</span></div>" | 68 "<div><span>BEFORE</span><span>MID</span><span>AFTER</span></div>" |
71 | 69 |
72 var root = document.createElement('div'); | 70 var root = document.createElement('div'); |
73 | 71 |
74 var sr = root.createShadowRoot(); | 72 var sr = root.createShadowRoot(); |
75 sr.appendChild(createSpanWithText('BEFORE')); | 73 sr.appendChild(createSpanWithText('BEFORE')); |
76 var shadow = document.createElement('shadow'); | 74 var shadow = document.createElement('shadow'); |
77 shadow.appendChild(document.createElement('content')); | |
78 sr.appendChild(shadow); | 75 sr.appendChild(shadow); |
79 sr.appendChild(createSpanWithText('AFTER')); | 76 sr.appendChild(createSpanWithText('AFTER')); |
80 | 77 |
81 document.getElementById('actual-container').appendChild(root); | 78 document.getElementById('actual-container').appendChild(root); |
82 | 79 |
83 var f = (function(callIfDone, root) { return function() { | 80 var f = (function(callIfDone, root) { return function() { |
84 root.appendChild(createSpanWithText('MID')); | 81 root.appendChild(createSpanWithText('MID')); |
85 callIfDone(); | 82 callIfDone(); |
86 }})(callIfDone, root); | 83 }})(callIfDone, root); |
87 | 84 |
88 setTimeout(f, 0); | 85 setTimeout(f, 0); |
89 }); | 86 }); |
90 | 87 |
91 testFuncs.push(function renderingLightChildrenDynamicallyRemoved(callIfDone) { | 88 testFuncs.push(function renderingLightChildrenDynamicallyRemoved(callIfDone) { |
92 document.getElementById('expect-container').innerHTML = | 89 document.getElementById('expect-container').innerHTML = |
93 "<div><span>BEFORE</span><span>MID</span><span>AFTER</span></div>" | 90 "<div><span>BEFORE</span><span>AFTER</span></div>" |
94 | 91 |
95 var root = document.createElement('div'); | 92 var root = document.createElement('div'); |
96 root.appendChild(createSpanWithText('SHOULD NOT BE RENDERED')); | 93 root.appendChild(createSpanWithText('SHOULD NOT BE RENDERED')); |
97 | 94 |
98 var shadow = document.createElement('shadow'); | 95 var shadow = document.createElement('shadow'); |
99 var content = document.createElement('content'); | |
100 content.appendChild(createSpanWithText('MID')); | |
101 shadow.appendChild(content); | |
102 | 96 |
103 var sr = root.createShadowRoot(); | 97 var sr = root.createShadowRoot(); |
104 sr.appendChild(createSpanWithText('BEFORE')); | 98 sr.appendChild(createSpanWithText('BEFORE')); |
105 sr.appendChild(shadow); | 99 sr.appendChild(shadow); |
106 sr.appendChild(createSpanWithText('AFTER')); | 100 sr.appendChild(createSpanWithText('AFTER')); |
107 | 101 |
108 document.getElementById('actual-container').appendChild(root); | 102 document.getElementById('actual-container').appendChild(root); |
109 | 103 |
110 var f = (function(callIfDone, root) { return function() { | 104 var f = (function(callIfDone, root) { return function() { |
111 root.removeChild(root.firstChild); | 105 root.removeChild(root.firstChild); |
112 callIfDone(); | 106 callIfDone(); |
113 }})(callIfDone, root); | 107 }})(callIfDone, root); |
114 | 108 |
115 setTimeout(f, 0); | 109 setTimeout(f, 0); |
116 }); | 110 }); |
117 | 111 |
118 </script> | 112 </script> |
119 </head> | 113 </head> |
120 <body onload="doTest(testFuncs)"> | 114 <body onload="doTest(testFuncs)"> |
121 | 115 |
122 <div id="actual-container" class="container"></div> | 116 <div id="actual-container" class="container"></div> |
123 <div id="expect-container" class="container"></div> | 117 <div id="expect-container" class="container"></div> |
124 <pre id="console"></pre> | 118 <pre id="console"></pre> |
125 | 119 |
126 </body> | 120 </body> |
127 </html> | 121 </html> |
OLD | NEW |