mirror of
https://github.com/servo/servo.git
synced 2025-07-31 19:20:22 +01:00
41 lines
985 B
HTML
41 lines
985 B
HTML
<html>
|
|
<head>
|
|
<script src="harness.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="foo"></div>
|
|
<script>
|
|
var sawBubble = false;
|
|
var sawCapture = false;
|
|
var sawBubbleTwice = false;
|
|
function handler(ev) {
|
|
is(ev.eventPhase, ev.AT_TARGET);
|
|
is(sawBubble, false);
|
|
is(sawCapture, false);
|
|
sawBubble = true;
|
|
}
|
|
function handler2(ev) {
|
|
is(ev.eventPhase, ev.AT_TARGET);
|
|
is(sawBubble, true);
|
|
is(sawCapture, false);
|
|
sawCapture = true;
|
|
}
|
|
function handler3(ev) {
|
|
is(ev.eventPhase, ev.AT_TARGET);
|
|
is(sawBubble, true);
|
|
is(sawCapture, true);
|
|
sawBubbleTwice = true;
|
|
}
|
|
|
|
var target = document.getElementById('foo');
|
|
target.addEventListener('foopy', handler, false);
|
|
target.addEventListener('foopy', handler2, true);
|
|
target.addEventListener('foopy', handler3, false);
|
|
var ev = new Event('foopy', {bubbles: true});
|
|
target.dispatchEvent(ev);
|
|
is(sawBubble, true);
|
|
is(sawCapture, true);
|
|
is(sawBubbleTwice, true);
|
|
</script>
|
|
</body>
|
|
</html>
|