OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../js/resources/js-test-pre.js"></script> | 4 <script src="../../js/resources/js-test-pre.js"></script> |
5 <script src="../resources/shadow-test-driver.js"></script> | 5 <script src="../resources/shadow-test-driver.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <p>This test checks nodes are reallyed attached.</p> | 8 <p>This test checks nodes are reallyed attached.</p> |
9 <pre id="console"></pre> | 9 <pre id="console"></pre> |
10 <div id="container"></div> | 10 <div id="container"></div> |
11 | 11 |
12 <script> | 12 <script> |
13 var container = document.getElementById("container"); | 13 var container = document.getElementById("container"); |
14 | 14 |
15 (function testAttachedInLightChildren() { | 15 (function testAttachedInLightChildren() { |
16 var root = document.createElement('div'); | 16 var root = document.createElement('div'); |
17 window.light = createSpanWithText('LIGHT'); | 17 window.light = createSpanWithText('LIGHT'); |
18 root.appendChild(light); | 18 root.appendChild(light); |
19 | 19 |
20 var shadowRoot = root.webkitCreateShadowRoot(); | 20 var shadowRoot = root.webkitCreateShadowRoot(); |
21 | 21 |
22 shouldBe('internals.attached(light)', 'false'); | 22 shouldBe('internals.attached(light)', 'false'); |
23 document.getElementById('container').appendChild(root); | 23 document.getElementById('container').appendChild(root); |
| 24 document.body.offsetLeft; // cause a style recalc to trigger attachment. |
24 shouldBe('internals.attached(light)', 'true'); | 25 shouldBe('internals.attached(light)', 'true'); |
25 })(); | 26 })(); |
26 | 27 |
27 (function testNotDistributedElementAttached() { | 28 (function testNotDistributedElementAttached() { |
28 var root = document.createElement('div'); | 29 var root = document.createElement('div'); |
29 window.light = createSpanWithText('LIGHT'); | 30 window.light = createSpanWithText('LIGHT'); |
30 root.appendChild(light); | 31 root.appendChild(light); |
31 | 32 |
32 var shadowRoot = root.webkitCreateShadowRoot(); | 33 var shadowRoot = root.webkitCreateShadowRoot(); |
33 shadowRoot.appendChild(createContentWithSelect('span')); | 34 shadowRoot.appendChild(createContentWithSelect('span')); |
34 | 35 |
35 shouldBe('internals.attached(light)', 'false'); | 36 shouldBe('internals.attached(light)', 'false'); |
36 document.getElementById('container').appendChild(root); | 37 document.getElementById('container').appendChild(root); |
| 38 document.body.offsetLeft; // cause a style recalc to trigger attachment. |
37 shouldBe('internals.attached(light)', 'true'); | 39 shouldBe('internals.attached(light)', 'true'); |
38 })(); | 40 })(); |
39 | 41 |
40 var successfullyParsed = true; | 42 var successfullyParsed = true; |
41 </script> | 43 </script> |
42 <script src="../../js/resources/js-test-post.js"></script> | 44 <script src="../../js/resources/js-test-post.js"></script> |
43 </body> | 45 </body> |
44 </html> | 46 </html> |
OLD | NEW |