OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <script src="../../resources/js-test.js"></script> | |
5 </head> | |
6 <body> | |
7 <form method="GET" id="form" onsubmit="formSubmit();afterSubmit(form);" target=" target"> | |
8 <input type="text" id="textData" name="textData" value="a"> | |
9 <input type="submit" id="submitButton" name="submitform" value="Step"> | |
10 </form> | |
11 <iframe id="target" name="target"></iframe> | |
12 <script> | |
13 description('Test that form.submit() when submitted from JS, form element added and removed, should submit the form without added element'); | |
14 | |
15 var hidden; | |
16 function formSubmit(event) | |
17 { | |
18 var textData = document.getElementById('textData'); | |
19 var form = document.getElementById('form'); | |
20 var submit = document.getElementById('submitButton'); | |
21 textData.value = 'b'; | |
22 hidden = document.createElement('hidden'); | |
23 hidden.value = submit.value; | |
24 hidden.name = submit.name; | |
25 form.appendChild(hidden); | |
26 form.submit(); | |
27 return true; | |
28 } | |
29 | |
30 function afterSubmit(form) | |
31 { | |
32 form.removeChild(hidden); | |
33 } | |
34 | |
35 document.getElementById('target').onload = function(event) { | |
36 shouldBeEqualToString('event.target.contentWindow.location.search', '?textDa ta=b&submitform=Step'); | |
37 finishJSTest(); | |
38 } | |
tkent
2014/08/08 00:49:33
nit: Need ';' because this is substitution express
| |
39 | |
40 window.onload = function() { | |
41 document.getElementById('submitButton').click(); | |
42 } | |
tkent
2014/08/08 00:49:32
Ditto.
| |
43 | |
44 if (window.testRunner) | |
45 window.jsTestIsAsync = true; | |
46 </script> | |
47 </body> | |
48 </html> | |
OLD | NEW |