Index: LayoutTests/fast/events/event-listener-on-attribute-inside-shadow-dom.html |
diff --git a/LayoutTests/fast/events/event-listener-on-attribute-inside-shadow-dom.html b/LayoutTests/fast/events/event-listener-on-attribute-inside-shadow-dom.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..12c7a0129227075a92ea14c60fec63c37e55e239 |
--- /dev/null |
+++ b/LayoutTests/fast/events/event-listener-on-attribute-inside-shadow-dom.html |
@@ -0,0 +1,30 @@ |
+<!DOCTYPE html> |
+<script src="../../resources/js-test.js"></script> |
+ |
+<div id="div1"></div> |
+<div id="div2"></div> |
+ |
+<script> |
+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('window.internals.touchEventHandlerCount(document)', '1'); |
+ |
+// Move the parent element into a shadow DOM. |
+shadowRoot.appendChild(div1); |
+ |
+// Move the shadow host into a new document. |
+var doc = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html'); |
+doc.adoptNode(div2); |
+ |
+// Make sure the handler was unregistered. |
+if (window.internals) |
+ shouldBe('window.internals.touchEventHandlerCount(document)', '0'); |
+ |
+</script> |