blob: 6721dc64d44f52f2c7387bd6ebfad4093b5a24a0 [file] [log] [blame]
<!DOCTYPE html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description('Moving an event listener between documents should keep it active');
var doc = document.implementation.createHTMLDocument('');
var div = doc.createElement('div');
var addedCalls = 0;
var removedCalls = 0;
div.addEventListener('DOMNodeInserted', function() { addedCalls++ });
div.addEventListener('DOMNodeRemoved', function() { removedCalls++ });
document.body.appendChild(div);
shouldBe('addedCalls', '1');
div.appendChild(document.createElement('span'));
shouldBe('addedCalls', '2');
div.removeChild(div.firstChild);
shouldBe('removedCalls', '1');
</script>
<script src="../../resources/js-test-post.js"></script>
</body>