summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/form-control-infrastructure/form_owner_and_table.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/semantics/forms/form-control-infrastructure/form_owner_and_table.html')
-rw-r--r--testing/web-platform/tests/html/semantics/forms/form-control-infrastructure/form_owner_and_table.html50
1 files changed, 50 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/forms/form-control-infrastructure/form_owner_and_table.html b/testing/web-platform/tests/html/semantics/forms/form-control-infrastructure/form_owner_and_table.html
new file mode 100644
index 0000000000..1aa75c27b3
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/forms/form-control-infrastructure/form_owner_and_table.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="root">
+ <form id='form1'></form>
+ <table id='table1'>
+ <form id='form2'>
+ <tr><td><input id='input1'></td></tr>
+ <tr><td><input id='input2' form='form1'></td></tr>
+ </table>
+ <form id="form3">
+ <input id="input3" />
+ </form>
+ </div>
+
+ <script>
+ test(function() {
+ var input1 = document.getElementById('input1');
+ var input2 = document.getElementById('input2');
+ var input3 = document.getElementById('input3');
+ var form1 = document.getElementById('form1');
+ var form2 = document.getElementById('form2');
+ var form3 = document.getElementById('form3');
+
+ var root = document.getElementById('root');
+
+ assert_equals(input1.form, form2,
+ "input1's form owner must be form2 as per the parsing rules");
+ assert_equals(input2.form, form1,
+ "input2's form owner must be the form with id 'form1'");
+ assert_equals(input3.form, form2,
+ "input3's form owner must be form2 as per the parsing rules");
+
+ root.parentNode.removeChild(root);
+
+ assert_equals(input1.form, form2,
+ "input1's form owner must not have changed since they are both in the same subtree");
+ assert_equals(input2.form, null,
+ "input2 must not have a form owner since it has the form attribute set");
+ assert_equals(input3.form, form2,
+ "input3's form owner must not have changed since they are both in the same subtree");
+
+ }, "Form element and form controls nested inside a table are correctly handled");
+ </script>
+ </body>
+</html>