Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: LayoutTests/fast/forms/submit-add-remove-element.html

Issue 449823003: Form submitted from JS should not submit double values (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/forms/submit-add-remove-element-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/forms/submit-add-remove-element-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698