Index: LayoutTests/fast/events/event-handler-count.html |
diff --git a/LayoutTests/fast/events/touch/touch-handler-count.html b/LayoutTests/fast/events/event-handler-count.html |
similarity index 80% |
rename from LayoutTests/fast/events/touch/touch-handler-count.html |
rename to LayoutTests/fast/events/event-handler-count.html |
index f63feed6a7814f23867b140ef6df96cb6810a9f6..7917d827567d90f2adb215cb563cbb018530a64e 100644 |
--- a/LayoutTests/fast/events/touch/touch-handler-count.html |
+++ b/LayoutTests/fast/events/event-handler-count.html |
@@ -1,7 +1,7 @@ |
-<script src="../../../resources/js-test.js"></script> |
+<script src="../../resources/js-test.js"></script> |
<div id='touchtarget' style='width: 50; height: 50'></div> |
<script> |
-description("This test checks that we correctly update the touch event handler count as event handlers are added and removed"); |
+description("This test checks that we correctly update the event handler counts as event handlers are added and removed"); |
debug("Test addEventListener/removeEventListener on the document."); |
(function() { |
@@ -29,50 +29,35 @@ debug("Test addEventListener/removeEventListener on the document."); |
shouldBe('window.internals.touchEventHandlerCount(document)', '0'); |
})(); |
-debug("Test setting touch handlers on the document."); |
+debug("Test setting scroll handlers on the document."); |
(function() { |
- shouldBe('window.internals.touchEventHandlerCount(document)', '0'); |
- document.ontouchstart = function() { } |
- document.ontouchmove = function() {} |
- document.ontouchend = function() {} |
- document.ontouchcancel = function() {} |
- shouldBe('window.internals.touchEventHandlerCount(document)', '4'); |
- document.ontouchstart = function() { } |
- shouldBe('window.internals.touchEventHandlerCount(document)', '4'); |
- document.ontouchstart = null; |
- shouldBe('window.internals.touchEventHandlerCount(document)', '3'); |
- document.ontouchstart = null; |
- shouldBe('window.internals.touchEventHandlerCount(document)', '3'); |
- document.ontouchmove = null; |
- document.ontouchend = null; |
- document.ontouchcancel = null; |
- shouldBe('window.internals.touchEventHandlerCount(document)', '0'); |
+ 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'); |
})(); |
debug("Test addEventListener/removeEventListener on the window."); |
(function() { |
var listener = function() { } |
- shouldBe('window.internals.touchEventHandlerCount(document)', '0'); |
- window.addEventListener('touchstart', listener, true); |
- shouldBe('window.internals.touchEventHandlerCount(document)', '1'); |
- window.addEventListener('touchmove', listener, true); |
- shouldBe('window.internals.touchEventHandlerCount(document)', '2'); |
- window.addEventListener('touchstart', listener, false); |
- shouldBe('window.internals.touchEventHandlerCount(document)', '3'); |
- window.removeEventListener('touchmove', listener, true); |
- shouldBe('window.internals.touchEventHandlerCount(document)', '2'); |
- window.removeEventListener('touchstart', listener, true); |
- shouldBe('window.internals.touchEventHandlerCount(document)', '1'); |
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '0'); |
+ window.addEventListener('mousewheel', listener, true); |
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '1'); |
+ window.addEventListener('mousewheel', listener, false); |
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '2'); |
+ window.removeEventListener('mousewheel', listener, true); |
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '1'); |
// Try removing the capturing listener again. |
- window.removeEventListener('touchstart', listener, true); |
- shouldBe('window.internals.touchEventHandlerCount(document)', '1'); |
- window.removeEventListener('touchmove', listener, true); |
- shouldBe('window.internals.touchEventHandlerCount(document)', '1'); |
+ window.removeEventListener('mousewheel', listener, true); |
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '1'); |
- window.removeEventListener('touchstart', listener, false); |
- shouldBe('window.internals.touchEventHandlerCount(document)', '0'); |
+ window.removeEventListener('mousewheel', listener, false); |
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '0'); |
})(); |
debug("Test setting touch handlers on the window."); |
@@ -95,6 +80,28 @@ debug("Test setting touch handlers on the window."); |
shouldBe('window.internals.touchEventHandlerCount(document)', '0'); |
})(); |
+debug("Test setting onmousewheel on the window."); |
+(function() { |
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '0'); |
+ window.onmousewheel = function() { } |
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '1'); |
+ window.onmousewheel = function() { } |
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '1'); |
+ window.onmousewheel = null; |
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '0'); |
+})(); |
+ |
+debug("Test setting onscroll on the window."); |
+(function() { |
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '0'); |
+ window.onscroll = function() { } |
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '1'); |
+ window.onscroll = function() { } |
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '1'); |
+ window.onscroll = null; |
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '0'); |
+})(); |
+ |
debug("Test addEventListener/removeEventListener on a div."); |
(function() { |
var listener = function() { } |
@@ -144,7 +151,7 @@ debug("Test setting touch handlers on a div."); |
shouldBe('window.internals.touchEventHandlerCount(document)', '0'); |
})(); |
-debug("Test redudant addEventListener on a div."); |
+debug("Test redundant addEventListener on a div."); |
Rick Byers
2014/04/03 15:33:19
heh, thanks for fixing my typo :-)
|
(function() { |
var listener = function() { } |
var div = document.getElementById('touchtarget'); |
@@ -246,15 +253,16 @@ debug("Test that nested Documents' touch handlers are properly tracked in their |
nestedDocument.write('<script>document.addEventListener("touchmove", function(){});</' + 'script>\n'); |
shouldBe('window.internals.touchEventHandlerCount(nestedDocument)', '3'); |
shouldBe('window.internals.touchEventHandlerCount(document)', '2'); |
- |
+ |
nestedDocument.write('<script>document.getElementById("twoHandlers").remove();</' + 'script>\n'); |
gc(); |
shouldBe('window.internals.touchEventHandlerCount(nestedDocument)', '1'); |
shouldBe('window.internals.touchEventHandlerCount(document)', '2'); |
- nestedDocument.close(); |
+ nestedDocument.close(); |
touchtarget.removeChild(iframe); |
shouldBe('window.internals.touchEventHandlerCount(document)', '1'); |
})(); |
+ |
</script> |
</body> |