Cleaned up mouseenter and mouseleave special events
This commit is contained in:
parent
859aa6c9df
commit
45e4a52cdd
32
src/event.js
32
src/event.js
|
@ -366,53 +366,45 @@ jQuery.event = {
|
||||||
|
|
||||||
mouseenter: {
|
mouseenter: {
|
||||||
setup: function() {
|
setup: function() {
|
||||||
if (jQuery.browser.msie) return false;
|
if ( jQuery.browser.msie ) return false;
|
||||||
jQuery(this).bind('mouseover', jQuery.event.special.mouseenter.handler);
|
jQuery(this).bind("mouseover", jQuery.event.special.mouseenter.handler);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
teardown: function() {
|
teardown: function() {
|
||||||
if (jQuery.browser.msie) return false;
|
if ( jQuery.browser.msie ) return false;
|
||||||
jQuery(this).unbind('mouseover', jQuery.event.special.mouseenter.handler);
|
jQuery(this).unbind("mouseover", jQuery.event.special.mouseenter.handler);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
handler: function(event) {
|
handler: function(event) {
|
||||||
var args = Array.prototype.slice.call( arguments, 1 );
|
|
||||||
// If we actually just moused on to a sub-element, ignore it
|
// If we actually just moused on to a sub-element, ignore it
|
||||||
if ( withinElement(event, this) ) return true;
|
if ( withinElement(event, this) ) return true;
|
||||||
// Execute the right handlers by setting the event type to mouseenter
|
// Execute the right handlers by setting the event type to mouseenter
|
||||||
event.type = 'mouseenter';
|
arguments[0].type = "mouseenter";
|
||||||
// Include the event object as the first argument
|
return jQuery.event.handle.apply(this, arguments);
|
||||||
args.unshift(event);
|
|
||||||
var val = jQuery.event.handle.apply(this, args);
|
|
||||||
return val;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mouseleave: {
|
mouseleave: {
|
||||||
setup: function() {
|
setup: function() {
|
||||||
if (jQuery.browser.msie) return false;
|
if ( jQuery.browser.msie ) return false;
|
||||||
jQuery(this).bind('mouseout', jQuery.event.special.mouseleave.handler);
|
jQuery(this).bind("mouseout", jQuery.event.special.mouseleave.handler);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
teardown: function() {
|
teardown: function() {
|
||||||
if (jQuery.browser.msie) return false;
|
if ( jQuery.browser.msie ) return false;
|
||||||
jQuery(this).unbind('mouseout', jQuery.event.special.mouseleave.handler);
|
jQuery(this).unbind("mouseout", jQuery.event.special.mouseleave.handler);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
handler: function(event) {
|
handler: function(event) {
|
||||||
var args = Array.prototype.slice.call( arguments, 1 );
|
|
||||||
// If we actually just moused on to a sub-element, ignore it
|
// If we actually just moused on to a sub-element, ignore it
|
||||||
if ( withinElement(event, this) ) return true;
|
if ( withinElement(event, this) ) return true;
|
||||||
// Execute the right handlers by setting the event type to mouseleave
|
// Execute the right handlers by setting the event type to mouseleave
|
||||||
event.type = 'mouseleave';
|
arguments[0].type = "mouseleave";
|
||||||
// Include the event object as the first argument
|
return jQuery.event.handle.apply(this, arguments);
|
||||||
args.unshift(event);
|
|
||||||
var val = jQuery.event.handle.apply(this, args);
|
|
||||||
return val;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue