dom/tests/mochitest/pointerlock/file_removedFromDOM.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:6f3adba10e48
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=633602
5
6 Test DOM tree in full screen
7 -->
8 <head>
9 <title>Bug 633602 - file_DOMtree.html</title>
10 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js">
11 </script>
12 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
13 </script>
14 <script type="application/javascript" src="pointerlock_utils.js"></script>
15 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
16 <style>
17 </style>
18 </head>
19 <body>
20 <a target="_blank"
21 href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
22 Mozilla Bug 633602
23 </a>
24 <div id="div"></div>
25 <pre id="test">
26 <script type="text/javascript">
27 /*
28 * Test for Bug 633602
29 * Checks if pointer is unlocked when element is removed from
30 * the DOM Tree
31 */
32
33 SimpleTest.waitForExplicitFinish();
34
35 var div = document.getElementById("div")
36 , removedDOM = false;
37
38 function runTests() {
39 ok(removedDOM, "Pointer should be unlocked when " +
40 "an element is removed the DOM Tree");
41 }
42
43 document.addEventListener("mozpointerlockchange", function (e) {
44 if (document.mozPointerLockElement === div) {
45 document.body.removeChild(div);
46 removedDOM = !document.mozPointerLockElement;
47 document.mozCancelFullScreen();
48 }
49
50 }, false);
51
52 document.addEventListener("mozfullscreenchange", function (e) {
53 if (document.mozFullScreenElement === div) {
54 div.mozRequestPointerLock();
55 }
56 else {
57 runTests();
58 SimpleTest.finish();
59 }
60 }, false);
61
62 function start() {
63 div.mozRequestFullScreen();
64 }
65 </script>
66 </pre>
67 </body>
68 </html>

mercurial