4 function window_listener(evt
)
6 var str
= phaseString(evt
.eventPhase
);
7 log("window " + evt
.type
+ " " + str
);
10 function reg_listener(evt
) {
11 var str
= phaseString(evt
.eventPhase
);
12 log(evt
.currentTarget
.id
+ " " + evt
.type
+ " " + str
);
16 function phaseString(phase
)
30 if (window
.testRunner
)
31 testRunner
.dumpAsText();
33 window
.addEventListener("submit", window_listener
, true);
34 document
.getElementById('outer_form').addEventListener("submit", reg_listener
, true);
35 document
.getElementById('inner_form').addEventListener("submit", reg_listener
, true);
36 document
.getElementById('div').addEventListener("submit", reg_listener
, true);
38 window
.addEventListener("submit", window_listener
, false);
39 document
.getElementById('outer_form').addEventListener("submit", reg_listener
, false);
40 document
.getElementById('inner_form').addEventListener("submit", reg_listener
, false);
41 document
.getElementById('div').addEventListener("submit", reg_listener
, false);
43 window
.addEventListener("reset", window_listener
, true);
44 document
.getElementById('outer_form').addEventListener("reset", reg_listener
, true);
45 document
.getElementById('inner_form').addEventListener("reset", reg_listener
, true);
46 document
.getElementById('div').addEventListener("reset", reg_listener
, true);
48 window
.addEventListener("reset", window_listener
, false);
49 document
.getElementById('outer_form').addEventListener("reset", reg_listener
, false);
50 document
.getElementById('inner_form').addEventListener("reset", reg_listener
, false);
51 document
.getElementById('div').addEventListener("reset", reg_listener
, false);
53 document
.getElementById('bt_reset').click();
58 var res
= document
.getElementById('res');
59 res
.innerHTML
= res
.innerHTML
+ msg
+ "<br>";
64 <body onload=
"test()">
65 This tests that we stop propagation when bubbling a submit or reset event to more than one form. This matches Firefox behavior
<br>
66 This can only occur when misnested tags cause forms to be nested.
<br>
68 You can manually test the submit event, but this automated test will only test the reset event.
70 <form id=
"outer_form">
75 <form id=
"inner_form">
76 <input type=submit
id=
"bt_submit" value=
"Submit"></input>
77 <input type=reset
id=
"bt_reset" value=
"Reset"></input>