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