<!DOCTYPE html>
<html>
<body>
<script>
</script>
<div contenteditable='true' id='div'>
<script>
if (window.testRunner)
    testRunner.dumpAsText();

var div = document.getElementById('div');
div.focus();
document.body.contentEditable = 'true';

function crash() {
    embed = document.createElement('embed');
    embed.setAttribute('type', 'text/foo');
    document.body.appendChild(embed);
    document.body.cloneNode(true);
}

function removeContent() {
    document.body.innerHTML = "Tests that we don't crash due to incorrect load event firing during cloneNode. <br />\
                               PASS. WebKit didn't crash.";
}

window.addEventListener('load', removeContent, false);
document.addEventListener('DOMContentLoaded', crash, false);
</script>
</body>
</html>
