2 <script src="../../resources/js-test.js"></script>
8 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.');
10 var div1 = document.getElementById('div1');
11 var div2 = document.getElementById('div2');
12 var shadowRoot = div2.createShadowRoot();
14 // Register an event listener on an attribute node.
15 div1.attributes[0].addEventListener('touchstart', function() { });
17 shouldBe('window.internals.touchEventHandlerCount(document)', '1');
19 // Move the parent element into a shadow DOM.
20 shadowRoot.appendChild(div1);
22 // Move the shadow host into a new document.
23 var doc = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html');
26 // Make sure the handler was unregistered.
28 shouldBe('window.internals.touchEventHandlerCount(document)', '0');