OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <body> |
| 5 <form action="javascript: redirect()"></form> |
| 6 <script> |
| 7 var f1 = document.forms[0]; |
| 8 test(function() { |
| 9 f1.parentNode.removeChild(f1); |
| 10 f1.submit(); |
| 11 }, 'Submitting a form that has been removed.'); |
| 12 |
| 13 var f2 = document.createElement('form'); |
| 14 f2.action = "javascript: redirect()"; |
| 15 test(function() { |
| 16 f2.submit(); |
| 17 }, 'Submitting a form that has never been attached to the document.'); |
| 18 |
| 19 document.body.appendChild(f2); |
| 20 var f3 = f2.cloneNode(true); |
| 21 f2.action = "javascript: submit_success()"; |
| 22 f3.action = "javascript: redirect()"; |
| 23 test(function() { |
| 24 f2.submit(); |
| 25 }, 'Submitting a form that is attached to the document.'); |
| 26 |
| 27 test(function() { |
| 28 f3.submit(); |
| 29 }, 'Submitting a form cloned from a form that is attached to the document.'); |
| 30 |
| 31 function redirect() { |
| 32 assert_unreached('A form should never be submitted if it is not attached to th
e document.'); |
| 33 } |
| 34 |
| 35 function submit_success() { |
| 36 assert_true(true, 'A form that is attached to the document should be submitted
.'); |
| 37 } |
| 38 |
| 39 </script> |
| 40 </body> |
OLD | NEW |