1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/webcomponents/test_bug900724.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,32 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=900724 1.8 +--> 1.9 +<head> 1.10 + <title>Test for form-association in template contents.</title> 1.11 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.13 +</head> 1.14 +<body> 1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=900724">Bug 900724</a> 1.16 +<form id="formone"><template id="templateone"><input></template></form> 1.17 +<form id="formthree"><template id="templatethree"></template></form> 1.18 +<form id="formfive"><template id="templatefive"></template></form> 1.19 +<script> 1.20 +is($("formone").elements.length, 0, "Forms should have no association with controls in template contents."); 1.21 + 1.22 +var templateOneInput = $("templateone").content.firstChild; 1.23 +is(templateOneInput.form, null, "Form controls inside template contents should not associate with forms."); 1.24 + 1.25 +// Try dynamically adding form/form controls using innerHTML. 1.26 +$("templatethree").innerHTML = '<input>'; 1.27 +is($("formthree").elements.length, 0, "Form controls inside template contents should not associate with forms."); 1.28 + 1.29 +// Append a form control as a child of the template (not template contents) and make sure form is associated. 1.30 +var formFiveInput = document.createElement("input"); 1.31 +$("templatefive").appendChild(formFiveInput); 1.32 +is($("formfive").elements.length, 1, "Form control should associate with form control not in template contents."); 1.33 +</script> 1.34 +</body> 1.35 +</html>