| 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 <script src="resources/shadow-dom.js"></script> |
| 5 </head> | 6 </head> |
| 6 <body> | 7 <body> |
| 7 <div id="host1"></div> | 8 <div id="host1"></div> |
| 8 <div id="host2"></div> | 9 <div id="host2"></div> |
| 9 <div id="host3"></div> | 10 <div id="host3"></div> |
| 10 <div id="host4"></div> | 11 <div id="host4"></div> |
| 11 </body> | 12 </body> |
| 12 <script> | 13 <script> |
| 13 debug('Create open shadow root.'); | 14 debug('Create open shadow root.'); |
| 14 var host1 = document.querySelector('#host1'); | 15 var host1 = document.querySelector('#host1'); |
| 15 var root1 = host1.createShadowRoot({mode: 'open'}); | 16 var root1 = host1.createShadowRoot({mode: 'open'}); |
| 16 shouldBeNonNull(root1); | 17 shouldBeNonNull(root1); |
| 17 | 18 |
| 18 debug('Create closed shadow root.'); | 19 debug('Create closed shadow root.'); |
| 19 var host2 = document.querySelector('#host2'); | 20 var host2 = document.querySelector('#host2'); |
| 20 // TODO(kochi): Closed mode is not implemented yet. crbug.com/459136 | 21 // TODO(kochi): Closed mode is not implemented yet. crbug.com/459136 |
| 21 shouldThrow("host2.createShadowRoot({mode: 'closed'})"); | 22 shouldThrow("host2.createShadowRoot({mode: 'closed'})"); |
| 22 | 23 |
| 23 debug('Create shadow root with empty parameter.'); | 24 debug('Create shadow root with empty parameter.'); |
| 24 var host3 = document.querySelector('#host3'); | 25 var host3 = document.querySelector('#host3'); |
| 25 var root3 = host3.createShadowRoot({}); | 26 var root3 = host3.createShadowRoot({}); |
| 26 shouldBeNonNull(root3); | 27 shouldBeNonNull(root3); |
| 27 | 28 |
| 28 debug('Create shadow root whose mode is neither open nor closed.'); | 29 debug('Create shadow root whose mode is neither open nor closed.'); |
| 29 var host4 = document.querySelector('#host4'); | 30 var host4 = document.querySelector('#host4'); |
| 30 shouldThrow("host4.createShadowRoot({mode: 'illegal'})"); | 31 shouldThrow("host4.createShadowRoot({mode: 'illegal'})"); |
| 32 |
| 33 debug('Create open shadow root with shadow-dom.js utility.'); |
| 34 document.body.appendChild( |
| 35 createDOM('div', {id: 'host5'}, |
| 36 createShadowRoot({mode: 'open'}))); |
| 37 var host5 = document.querySelector('#host5'); |
| 38 var root5 = host5.shadowRoot; |
| 39 shouldBeNonNull(root5); |
| 31 </script> | 40 </script> |
| 32 </html> | 41 </html> |
| OLD | NEW |