4 <script src=
"../../resources/js-test.js"></script>
7 <p id=
"description"></p>
8 <div id=
"console"></div>
9 <form id=f
action=
"interactive-validation-cancel.html">
10 <input type=hidden name=submitted
value=
"true">
11 <input name=i0 required
id=
"i0">
12 <input type=submit
id=
"s">
15 description('Test if the form is not submitted even if an "invalid" event for a control is canceled.');
17 function cancel(event
) {
18 event
.preventDefault();
21 function startOrVerify() {
22 var query
= window
.location
.search
;
23 if (query
.indexOf('submitted=true') != -1) {
24 testFailed('The form should not be submitted.');
25 shouldBeTrue('location.search.indexOf("i0=") != -1');
27 document
.getElementById('i0').addEventListener('invalid', cancel
, false);
28 // HTMLFormElement::submit() skips validation. Use the submit button.
29 document
.getElementById('s').click();
30 testPassed('The form was not submitted.');
32 debug('TEST COMPLETE');
33 if (window
.testRunner
)
34 testRunner
.notifyDone();
37 if (window
.testRunner
)
38 testRunner
.waitUntilDone();
39 window
.onload
= startOrVerify
;