| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src='../../resources/testharness.js'></script> |
| 3 <script src='../../resources/testharnessreport.js'></script> |
| 4 <script src='../resources/shadow-dom.js'></script> |
| 5 |
| 6 <div id='host'> |
| 7 <template data-mode='v0'> |
| 8 <content></content> |
| 9 </template> |
| 10 <div id='hostV0'> |
| 11 <template data-mode='v0'> |
| 12 <div id='hostV1inV0'> |
| 13 <template data-mode='open'> |
| 14 <canvas></canvas> |
| 15 </template> |
| 16 </div> |
| 17 </template> |
| 18 </div> |
| 19 </div> |
| 20 |
| 21 <script> |
| 22 async_test((test) => { |
| 23 document.onpointerlockerror = () => { |
| 24 assert_true(false, 'onpointerlockerror is not expected.'); |
| 25 test.done(); |
| 26 }; |
| 27 |
| 28 document.onpointerlockchange = () => { |
| 29 // Not interested in handling before or after exitPointerLock. |
| 30 if (document.pointerLockElement === null) |
| 31 return; |
| 32 |
| 33 assert_equals(document.pointerLockElement, hostV1inV0, 'if it is in V1,
return shadow host.'); |
| 34 assert_equals(host.shadowRoot.pointerLockElement, null); |
| 35 assert_equals(hostV0.shadowRoot.pointerLockElement, null); |
| 36 assert_equals(hostV1inV0.shadowRoot.pointerLockElement, canvas); |
| 37 |
| 38 document.exitPointerLock(); |
| 39 test.done(); |
| 40 }; |
| 41 |
| 42 convertTemplatesToShadowRootsWithin(host); |
| 43 var hostV1inV0 = hostV0.shadowRoot.querySelector('#hostV1inV0'); |
| 44 |
| 45 assert_equals(document.pointerLockElement, null); |
| 46 assert_equals(host.shadowRoot.pointerLockElement, null); |
| 47 assert_equals(hostV0.shadowRoot.pointerLockElement, null); |
| 48 assert_equals(hostV1inV0.shadowRoot.pointerLockElement, null); |
| 49 |
| 50 var canvas = hostV1inV0.shadowRoot.querySelector('canvas'); |
| 51 canvas.requestPointerLock(); |
| 52 }, 'Test for pointerLockElement adjustment for Shadow DOM V0/V1 combination.'); |
| 53 </script> |
| OLD | NEW |