blob: bf2b3db3feb00af3c4ef8d8babec5b8b06b1e01e [file] [log] [blame]
<p>This page tests various event attributes after dispatchEvent throws an exception.</p>
<p>If the test passes, you'll see a series of PASS messages below.</p>
<pre id="console"></pre>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function log(s)
{
document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
}
function shouldBe(aDescription, a, b)
{
if (a == b) {
log("PASS: " + aDescription + " should be " + b + " and is.");
return;
}
log("FAIL: " + aDescription + " should be " + b + " but instead is " + a + ".");
}
window.onload = function()
{
var event = document.createEvent("MouseEvent");
try {
document.getElementById("console").dispatchEvent(event);
} catch (e) {
} finally {
shouldBe("event.target", event.target, null);
shouldBe("event.currentTarget", event.currentTarget, null);
shouldBe("event.relatedTarget", event.relatedTarget, null);
shouldBe("event.eventPhase", event.eventPhase, 0);
}
};
</script>