| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/js-test.js"></script> | 2 <script src="../../../resources/js-test.js"></script> |
| 3 <body> | 3 <body> |
| 4 <div id="container" style="position: relative;"></div> | 4 <div id="container" style="position: relative;"></div> |
| 5 <script> | 5 <script> |
| 6 description('offsetParent should not leak nodes in user agent Shadow DOM.'); | 6 description('offsetParent should not leak nodes in user agent Shadow DOM.'); |
| 7 | 7 |
| 8 if (!window.internals) | 8 if (!window.internals) |
| 9 fail('This test requires window.internals to manipulate user agent Shadow DO
M.'); | 9 fail('This test requires window.internals to manipulate user agent Shadow DO
M.'); |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 var shadow = host.createShadowRoot(); | 24 var shadow = host.createShadowRoot(); |
| 25 configureShadowRoot(shadow); | 25 configureShadowRoot(shadow); |
| 26 shouldBe('child.offsetParent', 'shadow.positionedElement'); | 26 shouldBe('child.offsetParent', 'shadow.positionedElement'); |
| 27 | 27 |
| 28 // Test that offsetParent works 'through' Shadow DOM when there is no | 28 // Test that offsetParent works 'through' Shadow DOM when there is no |
| 29 // positioned ancestor in user agent Shadow DOM | 29 // positioned ancestor in user agent Shadow DOM |
| 30 shadow.positionedElement.removeAttribute('style'); | 30 shadow.positionedElement.removeAttribute('style'); |
| 31 shouldBe('child.offsetParent', 'container'); | 31 shouldBe('child.offsetParent', 'container'); |
| 32 | 32 |
| 33 // Test that when the offsetParent is in user agent Shadow DOM, it is | 33 // Test that when the offsetParent is in user agent Shadow DOM, it is |
| 34 // not exposed to script | 34 // not exposed to script, but its shadow host or the host's ancestor |
| 35 // which is appropriate as an offsetParent is returned. |
| 35 host = document.createElement('details'); | 36 host = document.createElement('details'); |
| 36 container.appendChild(host); | 37 container.appendChild(host); |
| 37 host.setAttribute('open', 'open'); | 38 host.setAttribute('open', 'open'); |
| 38 host.appendChild(child); | 39 host.appendChild(child); |
| 39 var shadow = window.internals.youngestShadowRoot(host); // this is a UA shadow
root | 40 var shadow = window.internals.youngestShadowRoot(host); // this is a UA shadow
root |
| 40 configureShadowRoot(shadow); | 41 configureShadowRoot(shadow); |
| 41 shouldBe('child.offsetParent', 'null'); | 42 shouldBe('child.offsetParent', 'container'); |
| 42 | 43 |
| 43 // Test that offsetParent works 'through' user agent Shadow DOM when there is no | 44 // Test that offsetParent works 'through' user agent Shadow DOM when there is no |
| 44 // positioned ancestor in user agent Shadow DOM | 45 // positioned ancestor in user agent Shadow DOM |
| 45 shadow.positionedElement.removeAttribute('style'); | 46 shadow.positionedElement.removeAttribute('style'); |
| 46 shouldBe('child.offsetParent', 'container'); | 47 shouldBe('child.offsetParent', 'container'); |
| 47 | 48 |
| 48 container.remove(); | 49 container.remove(); |
| 49 | 50 |
| 50 successfullyParsed = true; | 51 successfullyParsed = true; |
| 51 </script> | 52 </script> |
| OLD | NEW |