diff --git a/lib/OpenLayers/Handler/Click.js b/lib/OpenLayers/Handler/Click.js index a2b37e0e5b..04546c43c3 100644 --- a/lib/OpenLayers/Handler/Click.js +++ b/lib/OpenLayers/Handler/Click.js @@ -191,6 +191,7 @@ OpenLayers.Handler.Click = OpenLayers.Class(OpenLayers.Handler, { evt.xy = this.last.xy; evt.lastTouches = this.last.touches; this.handleSingle(evt); + this.down = null; } return true; }, diff --git a/tests/Handler/Click.html b/tests/Handler/Click.html index 43ab498463..2dada5c7f5 100644 --- a/tests/Handler/Click.html +++ b/tests/Handler/Click.html @@ -489,7 +489,7 @@ } function test_touch_click(t) { - t.plan(4); + t.plan(5); // set up @@ -511,6 +511,7 @@ // test + // the common case: a touchstart followed by a touchend log = null; handler.touchstart({xy: px(1, 1), touches: ["foo"]}); handler.touchend({touches: ["foo"]}); @@ -522,8 +523,19 @@ t.eq(log.y, 1, "evt.xy.y as expected"); t.ok(log.lastTouches, "evt.lastTouches as expected"); } - // tear down - map.destroy(); + + // now emulate a touch where touchstart doesn't propagate + // to the click handler, i.e. the click handler gets a + // touchend only + log = null; + handler.touchend({touches: ["foo"]}); + + t.delay_call(1, function() { + t.ok(log == null, "click callback not called"); + + // tear down + map.destroy(); + }); }); }