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

Unified Diff: third_party/WebKit/LayoutTests/fast/forms/submit-form-not-attached-to-document.html

Issue 2416033002: Fixed the behaviour of form submit to match the standard: no submit is taken place when the form is… (Closed)
Patch Set: Modified layout tests for the new behaviour Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/forms/submit-form-not-attached-to-document.html
diff --git a/third_party/WebKit/LayoutTests/fast/forms/submit-form-not-attached-to-document.html b/third_party/WebKit/LayoutTests/fast/forms/submit-form-not-attached-to-document.html
new file mode 100644
index 0000000000000000000000000000000000000000..08353c8e89953304962ec41b47eb1c6e5d5fc8f1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/forms/submit-form-not-attached-to-document.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<body>
+ <form action="javascript: redirect()"></form>
+<script>
+var f1 = document.forms[0];
+test(function() {
+ f1.parentNode.removeChild(f1);
+ f1.submit();
+}, 'Submitting a form that has been removed.');
+
+var f2 = document.createElement('form');
+f2.action = "javascript: redirect()";
+test(function() {
+ f2.submit();
+}, 'Submitting a form that has never been attached to the document.');
+
+document.body.appendChild(f2);
+var f3 = f2.cloneNode(true);
+f2.action = "javascript: submit_success()";
+f3.action = "javascript: redirect()";
+test(function() {
+ f2.submit();
+}, 'Submitting a form that is attached to the document.');
+
+test(function() {
+ f3.submit();
+}, 'Submitting a form cloned from a form that is attached to the document.');
+
+function redirect() {
+ assert_unreached('A form should never be submitted if it is not attached to the document.');
+}
+
+function submit_success() {
+ assert_true(true, 'A form that is attached to the document should be submitted.');
+}
+
+</script>
+</body>

Powered by Google App Engine
This is Rietveld 408576698