Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: LayoutTests/fast/events/scroll-event-handler-count.html

Issue 206603002: Add EventHandlerRegistry (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: One more unneeded include. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/events/scroll-event-handler-count-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/events/scroll-event-handler-count.html
diff --git a/LayoutTests/fast/events/scroll-event-handler-count.html b/LayoutTests/fast/events/scroll-event-handler-count.html
new file mode 100644
index 0000000000000000000000000000000000000000..7c757ab313869cccb09b79f1656ad16e01499805
--- /dev/null
+++ b/LayoutTests/fast/events/scroll-event-handler-count.html
@@ -0,0 +1,37 @@
+<div id="scrolltarget">
+<script src="../../resources/js-test.js"></script>
+<script>
+description("This test checks that we correctly update the scroll event handler count as event handlers are added and removed");
+(function() {
+ // Test addEventListener/removeEventListener on the document.
+ var listener = function() { }
+
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '0');
+ document.addEventListener('scroll', listener, true);
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '1');
+ document.addEventListener('scroll', listener, false);
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '2');
+ document.removeEventListener('scroll', listener, true);
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '1');
+
+ // Try removing the capturing listener again.
+ document.removeEventListener('scroll', listener, true);
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '1');
+
+ document.removeEventListener('scroll', listener, false);
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '0');
+})();
+
+(function() {
+ // Test setting onscroll on the document.
+
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '0');
+ document.onscroll = function() { }
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '1');
+ document.onscroll = function() { }
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '1');
+ document.onscroll = null;
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '0');
+})();
+</script>
+</body>
« no previous file with comments | « no previous file | LayoutTests/fast/events/scroll-event-handler-count-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698