blob: f6583585d4c22d8b944a5f8314ae22482fd24c04 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<div id="div1"></div>
<div id="div2"></div>
description('This tests ensures that an event listener on an attribute node inside a shadow DOM is properly unregistered when parent element of the attribute is moved to a new document.');
var div1 = document.getElementById('div1');
var div2 = document.getElementById('div2');
var shadowRoot = div2.createShadowRoot();
// Register an event listener on an attribute node.
div1.attributes[0].addEventListener('touchstart', function() { });
if (window.internals)
shouldBe('internals.touchStartOrMoveEventHandlerCount(document)', '1');
// Move the parent element into a shadow DOM.
// Move the shadow host into a new document.
var doc = document.implementation.createDocument('', 'html');
// Make sure the handler was unregistered.
if (window.internals)
shouldBe('internals.touchStartOrMoveEventHandlerCount(document)', '0');