Commit 5b0b1b77 authored by Aditya Raghavan's avatar Aditya Raghavan Committed by Dave Methvin

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
(cherry picked from commit 389b2ab3b93bfd68ca6c6153a43e11d93ab9ec71)
parent a0bf5bf7
...@@ -12,7 +12,7 @@ define([ ...@@ -12,7 +12,7 @@ define([
var rformElems = /^(?:input|select|textarea)$/i, var rformElems = /^(?:input|select|textarea)$/i,
rkeyEvent = /^key/, rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, rmouseEvent = /^(?:mouse|pointer|contextmenu|drag)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)/; rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
......
...@@ -2477,6 +2477,25 @@ test("fixHooks extensions", function() { ...@@ -2477,6 +2477,25 @@ test("fixHooks extensions", function() {
jQuery.event.fixHooks.click = saved; jQuery.event.fixHooks.click = saved;
}); });
// IE8 doesn't support custom event triggering natively, but we can skip
// this test in IE8 since a native HTML5 drag event will never occur there.
if ( document.createEvent ) {
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() { test( "focusin using non-element targets", function() {
expect( 2 ); expect( 2 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment