| OLD | NEW |
| 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 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <pre id="console"></div> | 7 <pre id="console"></div> |
| 8 <script> | 8 <script> |
| 9 description('Tests ShadowRoot.host property'); | 9 description('Tests ShadowRoot.host property'); |
| 10 | 10 |
| 11 function createRoots(host, n) { | 11 function createRoots(host, n) { |
| 12 var roots = []; | 12 var roots = []; |
| 13 for (var i = 0; i < n; i++) { | 13 for (var i = 0; i < n; i++) { |
| 14 roots.push(host.createShadowRoot()); | 14 roots.push(host.createShadowRoot()); |
| 15 } | 15 } |
| 16 return roots; | 16 return roots; |
| 17 } | 17 } |
| 18 | 18 |
| 19 var host = document.createElement('table'); | 19 var host = document.createElement('table'); |
| 20 var root = host.createShadowRoot(); | 20 var root = host.createShadowRoot(); |
| 21 shouldBe('root.host', 'host'); | 21 shouldBe('root.host', 'host'); |
| 22 | 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. | 23 // Multiple shadow roots. |
| 29 host = document.createElement('div'); | 24 host = document.createElement('div'); |
| 30 document.body.appendChild(host); | 25 document.body.appendChild(host); |
| 31 roots = createRoots(host, 2); | 26 roots = createRoots(host, 2); |
| 32 shouldBe('roots[0].host', 'host'); | 27 shouldBe('roots[0].host', 'host'); |
| 33 shouldBe('roots[1].host', 'host'); | 28 shouldBe('roots[1].host', 'host'); |
| 34 host.remove(); | 29 host.remove(); |
| 35 | 30 |
| 36 // Out of document | 31 // Out of document |
| 37 host = document.createElement('div'); | 32 host = document.createElement('div'); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 51 root = host.createShadowRoot(); | 46 root = host.createShadowRoot(); |
| 52 var donor = document.createElement('div'); | 47 var donor = document.createElement('div'); |
| 53 donor.createShadowRoot(); | 48 donor.createShadowRoot(); |
| 54 root.host = donor; | 49 root.host = donor; |
| 55 shouldBe('root.host', 'host'); | 50 shouldBe('root.host', 'host'); |
| 56 | 51 |
| 57 successfullyParsed = true; | 52 successfullyParsed = true; |
| 58 </script> | 53 </script> |
| 59 </body> | 54 </body> |
| 60 </html> | 55 </html> |
| OLD | NEW |