<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<div id="sample"></div>
<div id="log"></div>
<script>
var moved = false;
var sample = document.getElementById('sample');
var range = document.createRange();
range.setStart(sample, 0);
range.setEnd(sample, 0);
sample.addEventListener('DOMNodeRemoved', function() {
if (moved)
return;
moved = true;
document.implementation.createDocument('', null).appendChild(sample);
});
test(function() {
var doc = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html');
try {
doc.documentElement.appendChild(sample);
} catch (exception) {
assert_equals(exception.toString(), 'NotFoundError: Failed to execute \'appendChild\' on \'Node\': The node to be removed is no longer a child of this node. Perhaps it was moved in response to a mutation?');
}
});
</script>