servo/tests/content/test_load_event.html

36 lines
643 B
HTML

<html>
<head>
<script src="harness.js"></script>
</head>
<body>
<script>
waitForExplicitFinish();
var onloads = 0;
function check(ev) {
is_a(ev, Event);
ev.preventDefault();
is(ev.defaultPrevented, false);
is(ev.target, document);
is(ev.currentTarget, window);
if (onloads == 2) {
finish();
}
}
window.onload = function(ev) {
_fail("this inline handler should be overwritten");
}
window.onload = function(ev) {
onloads++;
is(onloads, 1);
check(ev);
}
addEventListener("load", function(ev) {
onloads++;
is(onloads, 2);
check(ev);
});
</script>
</body>
</html>