blob: 7537f01f06191d997d962986e278b71898199f1b [file] [log] [blame]
<!DOCTYPE html>
<script src='../../resources/testharness.js'></script>
<script src='../../resources/testharnessreport.js'></script>
<script src='../resources/shadow-dom.js'></script>
<div id='host'>
<template data-mode='v0'>
<content></content>
</template>
<div id='hostV0'>
<template data-mode='v0'>
<canvas></canvas>
</template>
</div>
</div>
<script>
async_test((test) => {
document.onpointerlockerror = test.unreached_func('onpointerlockerror is not expected.');
document.onpointerlockchange = test.step_func(() => {
// Not interested in handling before or after exitPointerLock.
if (document.pointerLockElement === null)
return;
assert_equals(document.pointerLockElement, canvas, 'if in V0, return the target itself.');
assert_equals(host.shadowRoot.pointerLockElement, null);
assert_equals(hostV0.shadowRoot.pointerLockElement, null);
document.exitPointerLock();
test.done();
});
convertTemplatesToShadowRootsWithin(host);
test.step(() => {
assert_equals(document.pointerLockElement, null);
assert_equals(host.shadowRoot.pointerLockElement, null);
assert_equals(hostV0.shadowRoot.pointerLockElement, null);
});
var canvas = hostV0.shadowRoot.querySelector('canvas');
canvas.requestPointerLock();
}, 'Test for pointerLockElement adjustment for Shadow DOM V0/V1 combination.');
</script>