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 <canvas></canvas> |
| 13 </template> |
| 14 </div> |
| 15 </div> |
| 16 |
| 17 <script> |
| 18 async_test((test) => { |
| 19 document.onpointerlockerror = () => { |
| 20 assert_true(false, 'onpointerlockerror is not expected.'); |
| 21 test.done(); |
| 22 }; |
| 23 |
| 24 document.onpointerlockchange = () => { |
| 25 // Not interested in handling before or after exitPointerLock. |
| 26 if (document.pointerLockElement === null) |
| 27 return; |
| 28 |
| 29 assert_equals(document.pointerLockElement, canvas, 'if in V0, return the
target itself.'); |
| 30 assert_equals(host.shadowRoot.pointerLockElement, null); |
| 31 assert_equals(hostV0.shadowRoot.pointerLockElement, null); |
| 32 |
| 33 document.exitPointerLock(); |
| 34 test.done(); |
| 35 }; |
| 36 |
| 37 convertTemplatesToShadowRootsWithin(host); |
| 38 |
| 39 assert_equals(document.pointerLockElement, null); |
| 40 assert_equals(host.shadowRoot.pointerLockElement, null); |
| 41 assert_equals(hostV0.shadowRoot.pointerLockElement, null); |
| 42 |
| 43 var canvas = hostV0.shadowRoot.querySelector('canvas'); |
| 44 canvas.requestPointerLock(); |
| 45 }, 'Test for pointerLockElement adjustment for Shadow DOM V0/V1 combination.'); |
| 46 </script> |
OLD | NEW |