Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / event-attributes-after-exception.html
blobbf2b3db3feb00af3c4ef8d8babec5b8b06b1e01e
1 <p>This page tests various event attributes after dispatchEvent throws an exception.</p>
2 <p>If the test passes, you'll see a series of PASS messages below.</p>
4 <pre id="console"></pre>
6 <script>
7 if (window.testRunner)
8 testRunner.dumpAsText();
10 function log(s)
12 document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
15 function shouldBe(aDescription, a, b)
17 if (a == b) {
18 log("PASS: " + aDescription + " should be " + b + " and is.");
19 return;
21 log("FAIL: " + aDescription + " should be " + b + " but instead is " + a + ".");
24 window.onload = function()
26 var event = document.createEvent("MouseEvent");
27 try {
28 document.getElementById("console").dispatchEvent(event);
29 } catch (e) {
30 } finally {
31 shouldBe("event.target", event.target, null);
32 shouldBe("event.currentTarget", event.currentTarget, null);
33 shouldBe("event.relatedTarget", event.relatedTarget, null);
34 shouldBe("event.eventPhase", event.eventPhase, 0);
37 </script>