Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / submit-add-remove-element.html
blobc54f4a335d592de11618f9e9d25fa602131eb59c
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');
15 var hidden;
16 function formSubmit(event)
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;
30 function afterSubmit(form)
32 form.removeChild(hidden);
35 document.getElementById('target').onload = function(event) {
36 shouldBeEqualToString('event.target.contentWindow.location.search', '?textData=b&submitform=Step');
37 finishJSTest();
40 window.onload = function() {
41 document.getElementById('submitButton').click();
44 if (window.testRunner)
45 window.jsTestIsAsync = true;
46 </script>
47 </body>
48 </html>