diff options
author | Aditya Raghavan <araghavan3@gmail.com> | 2014-12-20 18:41:24 -0500 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2015-01-05 15:34:52 -0500 |
commit | 97cf5280824027c3d4fcdbb4db49c10ad3c62bce (patch) | |
tree | 97d443980c1f92e4cd98306a2b2928ad118cf0f6 | |
parent | 66e1b6b8d49812239b5712d65922ff94c60f7b02 (diff) | |
download | jquery-97cf5280824027c3d4fcdbb4db49c10ad3c62bce.tar.gz jquery-97cf5280824027c3d4fcdbb4db49c10ad3c62bce.zip |
Event: Normalize mouse event properties in drag events
DragEvent is a superset of MouseEvent, so we want to fix up mouse
properties like pageX and pageY.
Fixes gh-1925
-rw-r--r-- | src/event.js | 2 | ||||
-rw-r--r-- | test/unit/event.js | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/event.js b/src/event.js index 93b68d25f..11b2ea904 100644 --- a/src/event.js +++ b/src/event.js @@ -14,7 +14,7 @@ define([ var rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, + rmouseEvent = /^(?:mouse|pointer|contextmenu|drag)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, rtypenamespace = /^([^.]*)(?:\.(.+)|)/; diff --git a/test/unit/event.js b/test/unit/event.js index 8e33c6b90..d3a7ef231 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -2444,6 +2444,20 @@ test("fixHooks extensions", function() { jQuery.event.fixHooks.click = saved; }); +test( "drag events copy over mouse related event properties (gh-1925)", function() { + expect( 2 ); + + var $fixture = jQuery( "<div id='drag-fixture'></div>" ).appendTo( "body" ); + + $fixture.on( "dragmove", function( evt ) { + ok( "pageX" in evt, "checking for pageX property" ); + ok( "pageY" in evt, "checking for pageY property" ); + }); + + fireNative( $fixture[ 0 ], "dragmove" ); + $fixture.unbind( "dragmove" ).remove(); +}); + test( "focusin using non-element targets", function() { expect( 2 ); |