| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../js/resources/js-test-pre.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <pre id="console"></div> |
| 8 <script> |
| 9 description('Tests ShadowRoot.host property'); |
| 10 |
| 11 function createRoots(host, n) { |
| 12 var roots = []; |
| 13 for (var i = 0; i < n; i++) { |
| 14 roots.push(host.createShadowRoot()); |
| 15 } |
| 16 return roots; |
| 17 } |
| 18 |
| 19 var host = document.createElement('table'); |
| 20 var root = host.createShadowRoot(); |
| 21 shouldBe('root.host', 'host'); |
| 22 |
| 23 // For elements which has UA shadow root. |
| 24 host = document.createElement('details'); |
| 25 root = host.createShadowRoot(); |
| 26 shouldBe('root.host', 'host'); |
| 27 |
| 28 // Multiple shadow roots. |
| 29 host = document.createElement('div'); |
| 30 document.body.appendChild(host); |
| 31 roots = createRoots(host, 2); |
| 32 shouldBe('roots[0].host', 'host'); |
| 33 shouldBe('roots[1].host', 'host'); |
| 34 host.remove(); |
| 35 |
| 36 // Out of document |
| 37 host = document.createElement('div'); |
| 38 var roots = createRoots(host, 2); |
| 39 shouldBe('roots[0].host', 'host'); |
| 40 shouldBe('roots[1].host', 'host'); |
| 41 |
| 42 // Out of document, in nested shadow, accessed out of order |
| 43 host = document.createElement('span'); |
| 44 roots[1].appendChild(host); |
| 45 roots = createRoots(host, 7); |
| 46 shouldBe('roots[1].host', 'host'); |
| 47 shouldBe('roots[6].host', 'host'); |
| 48 |
| 49 // Cannot set property |
| 50 host = document.createElement('span'); |
| 51 root = host.createShadowRoot(); |
| 52 var donor = document.createElement('div'); |
| 53 donor.createShadowRoot(); |
| 54 root.host = donor; |
| 55 shouldBe('root.host', 'host'); |
| 56 |
| 57 successfullyParsed = true; |
| 58 </script> |
| 59 <script src="../../js/resources/js-test-post.js"></script> |
| 60 </body> |
| 61 </html> |
| OLD | NEW |