test_bug335976.xhtml (1662B)
1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <!-- 3 https://bugzilla.mozilla.org/show_bug.cgi?id=335976 4 --> 5 <head> 6 <title>Test for Bug 335976</title> 7 <script src="/tests/SimpleTest/SimpleTest.js"></script> 8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 9 </head> 10 <body> 11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=335976">Mozilla Bug 335976</a> 12 <p id="display"></p> 13 14 <iframe srcdoc="<html xmlns='http://www.w3.org/1999/xhtml'><body> <input> </body></html>" style="width: 95%; height: 150px;"></iframe> 15 16 <div id="rootish" style="background: yellow"> 17 <div> 18 <input/> 19 </div> 20 </div> 21 22 23 <div id="content" style="display: none"> 24 25 </div> 26 <pre id="test"> 27 <script class="testbody" type="text/javascript"> 28 <![CDATA[ 29 30 function lookAtTextboxesIn(root, numExpected) 31 { 32 var textboxes = root.getElementsByTagName("input"); 33 var threw; 34 var i; 35 var n; 36 37 for (i = 0; (n = textboxes[i]); ++i) { 38 threw = true; 39 try { n.nodeType; threw = false; } catch(e) { } 40 ok(!threw, "n.nodeType threw"); 41 } 42 43 ok(textboxes.length == numExpected, "Wrong number of textboxes"); 44 } 45 46 function init() 47 { 48 // Look at the textbox in the yellow div. 49 lookAtTextboxesIn(document.getElementById('rootish'), 1); 50 51 // Move the yellow div into the iframe. 52 var nd = window.frames[0].document; 53 nd.body.appendChild(nd.adoptNode(document.getElementById('rootish'))); 54 55 // Look at the textboxes in the iframe. 56 lookAtTextboxesIn(window.frames[0].document.body, 2); 57 58 SimpleTest.finish(); 59 } 60 61 SimpleTest.waitForExplicitFinish(); 62 addLoadEvent(init); 63 64 ]]> 65 </script> 66 </pre> 67 </body> 68 </html>