38 lines
1.0 KiB
HTML
38 lines
1.0 KiB
HTML
<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>
|