2 function handleEvent(message
) {
3 document
.getElementById("log").innerHTML
= "PASS: " + message
+ " handled.<br>";
7 if (window
.testRunner
) {
8 testRunner
.dumpAsText();
11 var doctype
= document
.implementation
.createDocumentType(
13 '-//W3C//DTD XHTML 1.0 Strict//EN',
14 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'
17 var evt
= document
.createEvent("Event");
18 evt
.initEvent("generic", true, true);
19 doctype
.addEventListener("generic", function () { handleEvent("generic")}, false);
20 doctype
.dispatchEvent(evt
);
23 <body onload=
"test()">
24 <p>The test verifies that EventTarget with an event listener not inserted into a Document does not crash during an attempt to dispatch an event.
</p>
25 <p>Test passes if there is no crash, and event is dispatched.
</p>
26 <div id=
"log">FAIL
</div>