[Release] Webkit-EFL Ver. 2.0_beta_118996_0.6.22
[framework/web/webkit-efl.git] / LayoutTests / fast / events / event-attributes-after-exception.html
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>
3
4 <pre id="console"></pre>
5
6 <script>
7 if (window.layoutTestController)
8     layoutTestController.dumpAsText();
9
10 function log(s)
11 {
12     document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
13 }
14
15 function shouldBe(aDescription, a, b)
16 {
17     if (a == b) {
18         log("PASS: " + aDescription + " should be " + b + " and is.");
19         return;
20     }
21     log("FAIL: " + aDescription + " should be " + b + " but instead is " + a + ".");
22 }
23
24 window.onload = function()
25 {
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);
35     }
36 };
37 </script>