<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <body onload="addImg()"> <style> .killme { display:none } </style> <div style="overflow:hidden; position:absolute; width:150px; height:150px; top:50px; left:0px"> <div id='parent' style="overflow:hidden; position:absolute; width:150px; height:150px; top:50px; left:0px"> <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <g> <rect id='rrr' x='0' y='0' width='10' height='10'/> </g> </svg> </div> </div> <script> function boomie() { document.body.offsetTop; document.getElementById('rrr').setAttribute('x', '20'); document.getElementById('parent').className='killme'; } function addImg() { window.setTimeout(function() { var i = new Image(); i.src = 'http://www.webkit.org/nosuchfile.png'; document.body.appendChild(i); i.onerror = boomie; }, 15); } </script> </body> </html>