summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/pointer-lock/lock-element-not-in-dom.html
blob: 5b3e48594fd928cd12cf4b1890992b9138afee99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE HTML>
<html>
<head>
<script src="../resources/js-test.js"></script>
<script src="../http/tests/resources/pointer-lock/pointer-lock-test-harness.js"></script>
</head>
<body>
<div>
  <div id="target1"></div>
</div>
<script>
    description("Test locking an element not in a document is rejected and pointerlockerror event dispatched.")
    window.jsTestIsAsync = true;

    targetDiv1 = document.getElementById("target1");

    todo = [
        function () {
            shouldNotBe("targetDiv1.parentElement", "null");
            expectOnlyErrorEvent("Remove targetDiv1 from document, and try to lock it.");
            targetDiv1.parentElement.removeChild(targetDiv1);
            shouldBe("targetDiv1.parentElement", "null");
            targetDiv1.webkitRequestPointerLock();
            // doNextStep called by event handler.
        },
    ];
    doNextStepWithUserGesture();
</script>
</body>
</html>