1 <html> 2 <head> 3 <script> 4 if (window.layoutTestController) { 5 layoutTestController.dumpAsText(); 6 layoutTestController.waitUntilDone(); 7 } 8 9 var container1; 10 var container2; 11 var elem; 12 13 function handler2() 14 { 15 container2.appendChild(elem); 16 } 17 18 function onload() 19 { 20 container1 = document.getElementById("newcontainer1"); 21 container2 = document.getElementById("newcontainer2"); 22 23 if (!window.eventSender) 24 return; 25 26 var rect = document.getElementById("trigger").getBoundingClientRect(); 27 eventSender.mouseMoveTo(rect.left + rect.width / 2, rect.top + rect.height / 2); 28 eventSender.mouseDown(); 29 eventSender.mouseUp(); 30 } 31 32 function onpress() 33 { 34 elem = document.getElementById("subcontainer1"); 35 document.getElementById("sub1").focus(); 36 37 try { 38 container1.appendChild(elem); 39 container1.removeChild(elem); 40 elem = null; 41 } 42 catch (e) { } 43 44 // Force GC. 45 if (this.GCController) 46 GCController.collect(); 47 else { 48 for (var i = 0; i < 10000; ++i) { 49 ({ }); 50 } 51 } 52 53 document.body.removeChild(container2); 54 55 if (window.layoutTestController) 56 layoutTestController.notifyDone(); 57 58 } 59 60 </script> 61 </head> 62 <body onload="onload()"> 63 <p>Tests for proper handling of DOM changes during a blur event. If the test doesn't crash, it passed. 64 <div id="subcontainer1"> 65 <textarea id="sub1" onblur="handler2()"></textarea> 66 </div> 67 68 <input id="trigger" type="button" name="Press" value="press" onclick="onpress()"> 69 <div id="newcontainer1"></div> 70 <div id="newcontainer2"></div> 71 72 </body> 73 </html> 74