OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../resources/js-test.js"></script> |
| 3 |
| 4 <div id="div1"></div> |
| 5 <div id="div2"></div> |
| 6 |
| 7 <script> |
| 8 description('This tests ensures that an event listener on an attribute node insi
de a shadow DOM is properly unregistered when parent element of the attribute is
moved to a new document.'); |
| 9 |
| 10 var div1 = document.getElementById('div1'); |
| 11 var div2 = document.getElementById('div2'); |
| 12 var shadowRoot = div2.createShadowRoot(); |
| 13 |
| 14 // Register an event listener on an attribute node. |
| 15 div1.attributes[0].addEventListener('touchstart', function() { }); |
| 16 if (window.internals) |
| 17 shouldBe('window.internals.touchEventHandlerCount(document)', '1'); |
| 18 |
| 19 // Move the parent element into a shadow DOM. |
| 20 shadowRoot.appendChild(div1); |
| 21 |
| 22 // Move the shadow host into a new document. |
| 23 var doc = document.implementation.createDocument('http://www.w3.org/1999/xhtml',
'html'); |
| 24 doc.adoptNode(div2); |
| 25 |
| 26 // Make sure the handler was unregistered. |
| 27 if (window.internals) |
| 28 shouldBe('window.internals.touchEventHandlerCount(document)', '0'); |
| 29 |
| 30 </script> |
OLD | NEW |