|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=900724 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for form-association in template contents.</title> |
|
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
10 </head> |
|
11 <body> |
|
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=900724">Bug 900724</a> |
|
13 <form id="formone"><template id="templateone"><input></template></form> |
|
14 <form id="formthree"><template id="templatethree"></template></form> |
|
15 <form id="formfive"><template id="templatefive"></template></form> |
|
16 <script> |
|
17 is($("formone").elements.length, 0, "Forms should have no association with controls in template contents."); |
|
18 |
|
19 var templateOneInput = $("templateone").content.firstChild; |
|
20 is(templateOneInput.form, null, "Form controls inside template contents should not associate with forms."); |
|
21 |
|
22 // Try dynamically adding form/form controls using innerHTML. |
|
23 $("templatethree").innerHTML = '<input>'; |
|
24 is($("formthree").elements.length, 0, "Form controls inside template contents should not associate with forms."); |
|
25 |
|
26 // Append a form control as a child of the template (not template contents) and make sure form is associated. |
|
27 var formFiveInput = document.createElement("input"); |
|
28 $("templatefive").appendChild(formFiveInput); |
|
29 is($("formfive").elements.length, 1, "Form control should associate with form control not in template contents."); |
|
30 </script> |
|
31 </body> |
|
32 </html> |