test_form_attribute-4.html (1338B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=588683 5 --> 6 <head> 7 <title>Test for form attributes 4</title> 8 <script 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=588683">Mozilla Bug 588683</a> 13 <p id="display"></p> 14 <div id="content" style='display:none;'> 15 <form id='f'> 16 </form> 17 <table id='t'> 18 <form id='f2'> 19 <tr><td><input id='i1'></td></tr> 20 <tr><td><input id='i2' form='f'></td></tr> 21 </form> 22 </table> 23 </div> 24 <pre id="test"> 25 <script type="application/javascript"> 26 27 /** Test for form attributes 4 */ 28 29 var table = document.getElementById('t'); 30 var i1 = document.getElementById('i1'); 31 var i2 = document.getElementById('i2'); 32 33 is(i1.form, document.getElementById('f2'), 34 "i1 form should be it's parent"); 35 is(i2.form, document.getElementById('f'), 36 "i1 form should be the form with the id in @form"); 37 38 table.removeChild(document.getElementById('f2')); 39 is(i1, document.getElementById('i1'), 40 "i1 should still be in the document"); 41 is(i1.form, null, "i1 should not have any form owner"); 42 is(i2.form, document.getElementById('f'), 43 "i1 form should be the form with the id in @form"); 44 45 </script> 46 </pre> 47 </body> 48 </html>