4 function print(message
, color
)
6 var paragraph
= document
.createElement("div");
7 paragraph
.appendChild(document
.createTextNode(message
));
8 paragraph
.style
.fontFamily
= "monospace";
10 paragraph
.style
.color
= color
;
11 document
.getElementById("console").appendChild(paragraph
);
16 if (window
.testRunner
)
17 testRunner
.dumpAsText();
20 document
.getElementById('div1').onsubmit = function () {
22 return false; // returning false cancels form submission
24 document
.getElementById('input1').click();
29 print("PASS: containing element " + id
+ " caught submit event", "green");
34 print("FAIL: containing element did not cancel submit event", "red");
39 <body onload=
"test();">
40 <p>This page tests whether the form 'submit' event bubbles to containing elements.
41 If it passes, you'll see 'PASS' messages below.
</p>
43 <div id='console'
></div>
45 <div id=
"div2" onsubmit=
"pass(this.id);">
46 <form id=
"form1" action=
"javascript:fail();"> <!-- only executes if form submits -->
47 <input id=
"input1" type=
"submit">