OLD | NEW |
1 <script> | 1 <script> |
2 function handleEvent(message) { | 2 function handleEvent(message) { |
3 document.getElementById("log").innerHTML = "FAIL: " + message + " handled.<b
r>"; | 3 document.getElementById("log").innerHTML = "PASS: " + message + " handled.<b
r>"; |
4 } | 4 } |
5 | 5 |
6 function test() { | 6 function test() { |
7 if (window.testRunner) { | 7 if (window.testRunner) { |
8 testRunner.dumpAsText(); | 8 testRunner.dumpAsText(); |
9 } | 9 } |
10 | 10 |
11 var doctype = document.implementation.createDocumentType( | 11 var doctype = document.implementation.createDocumentType( |
12 'html', | 12 'html', |
13 '-//W3C//DTD XHTML 1.0 Strict//EN', | 13 '-//W3C//DTD XHTML 1.0 Strict//EN', |
14 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd' | 14 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd' |
15 ); | 15 ); |
16 | 16 |
17 var evt = document.createEvent("Event"); | 17 var evt = document.createEvent("Event"); |
18 evt.initEvent("generic", true, true); | 18 evt.initEvent("generic", true, true); |
19 doctype.addEventListener("generic", function () { handleEvent("generic")}, f
alse); | 19 doctype.addEventListener("generic", function () { handleEvent("generic")}, f
alse); |
20 doctype.dispatchEvent(evt); | 20 doctype.dispatchEvent(evt); |
21 } | 21 } |
22 </script> | 22 </script> |
23 <body onload="test()"> | 23 <body onload="test()"> |
24 <p>The test verifies that EventTarget with an event listener but without ScriptE
xecutionContext (not inserted into Document) does not crash during an attempt to
dispatch an event. It should just not call the handler. This is what FF 3.5 is
also doing.</p> | 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 not dispatched.</p> | 25 <p>Test passes if there is no crash, and event is dispatched.</p> |
26 <div id="log">PASS</div> | 26 <div id="log">FAIL</div> |
OLD | NEW |