1 <p>This page verifies that queued event listeners keep firing even after a node has been removed from the document.
</p>
2 <p>If the test passes, you'll see a PASS message below.
</p>
4 <pre id=
"console"></pre>
10 testRunner
.dumpAsText();
14 document
.getElementById("console").appendChild(document
.createTextNode(s
+ "\n"));
19 function reportResult(expected
)
22 var end
= result
.length
> expected
.length
? result
.length
: expected
.length
;
23 for (var i
= 0; i
< end
; ++i
) {
24 if (result
[i
] != expected
[i
]) {
25 log("FAIL: " + name
+ " result[" + i
+ "] should be " + expected
[i
] + " but instead is " + result
[i
] + ".");
30 log("PASS: result should be " + expected
+ " and is.");
33 var div
= document
.getElementById("div");
34 div
.addEventListener("click", function f1() {
35 result
.push(arguments
.callee
.name
);
36 div
.parentNode
.removeChild(div
);
39 div
.addEventListener("click", function f2() {
40 result
.push(arguments
.callee
.name
);
43 var event
= document
.createEvent("MouseEvent");
44 event
.initMouseEvent("click", true, true, document
.defaultView
, 1, 0, 0, 0, 0, false, false, false, false, 0, document
);
45 div
.dispatchEvent(event
);
47 reportResult([ "f1", "f2" ]);