Merge pull request #395 from msalsbery/chrome-mouse

Removed mousenter/mouseleave DOM Event Handling
This commit is contained in:
iangilman 2014-05-05 10:02:39 -07:00
commit d319667fe1

View File

@ -174,8 +174,6 @@
* Are we curruently capturing mouse events (legacy mouse events only).
*/
THIS[ this.hash ] = {
setCaptureCapable: !!this.element.setCapture && !!this.element.releaseCapture,
click: function ( event ) { onClick( _this, event ); },
dblclick: function ( event ) { onDblClick( _this, event ); },
keypress: function ( event ) { onKeyPress( _this, event ); },
@ -795,6 +793,14 @@
document.onmousewheel !== undefined ? 'mousewheel' : // Webkit and IE support at least 'mousewheel'
'DOMMouseScroll'; // Assume old Firefox
/**
* Detect legacy mouse capture support.
*/
$.MouseTracker.supportsMouseCapture = (function () {
var divElement = document.createElement( 'div' );
return $.isFunction( divElement.setCapture ) && $.isFunction( divElement.releaseCapture );
}());
/**
* Detect browser pointer device event model(s) and build appropriate list of events to subscribe to.
*/
@ -829,14 +835,9 @@
$.MouseTracker.haveMouseEnter = true;
} else {
// Legacy W3C mouse events
$.MouseTracker.subscribeEvents.push( "mousedown", "mouseup", "mousemove" );
if ( 'onmouseenter' in window ) {
$.MouseTracker.subscribeEvents.push( "mouseenter", "mouseleave" );
$.MouseTracker.haveMouseEnter = true;
} else {
$.MouseTracker.subscribeEvents.push( "mouseover", "mouseout" );
// TODO: Favor mouseenter/mouseleave over mouseover/mouseout when Webkit browser support is better
$.MouseTracker.subscribeEvents.push( "mouseover", "mouseout", "mousedown", "mouseup", "mousemove" );
$.MouseTracker.haveMouseEnter = false;
}
if ( 'ontouchstart' in window ) {
// iOS, Android, and other W3c Touch Event implementations (see http://www.w3.org/TR/2011/WD-touch-events-20110505)
$.MouseTracker.subscribeEvents.push( "touchstart", "touchend", "touchmove", "touchcancel" );
@ -1082,7 +1083,7 @@
var delegate = THIS[ tracker.hash ];
if ( !delegate.capturing ) {
if ( delegate.setCaptureCapable ) {
if ( $.MouseTracker.supportsMouseCapture ) {
// IE<10, Firefox, other browsers with setCapture()/releaseCapture()
tracker.element.setCapture( true );
} else {
@ -1115,7 +1116,7 @@
var delegate = THIS[ tracker.hash ];
if ( delegate.capturing ) {
if ( delegate.setCaptureCapable ) {
if ( $.MouseTracker.supportsMouseCapture ) {
// IE<10, Firefox, other browsers with setCapture()/releaseCapture()
tracker.element.releaseCapture();
} else {