mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
The special.handle hook is for origType, not the mapped type.
This commit is contained in:
parent
dd363d2c0f
commit
e977a85b87
16
src/event.js
16
src/event.js
@ -405,7 +405,6 @@ jQuery.event = {
|
|||||||
delegateCount = handlers.delegateCount,
|
delegateCount = handlers.delegateCount,
|
||||||
args = [].slice.call( arguments, 0 ),
|
args = [].slice.call( arguments, 0 ),
|
||||||
run_all = !event.exclusive && !event.namespace,
|
run_all = !event.exclusive && !event.namespace,
|
||||||
specialHandle = ( jQuery.event.special[ event.type ] || {} ).handle,
|
|
||||||
handlerQueue = [],
|
handlerQueue = [],
|
||||||
i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;
|
i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;
|
||||||
|
|
||||||
@ -464,7 +463,8 @@ jQuery.event = {
|
|||||||
event.data = handleObj.data;
|
event.data = handleObj.data;
|
||||||
event.handleObj = handleObj;
|
event.handleObj = handleObj;
|
||||||
|
|
||||||
ret = ( specialHandle || handleObj.handler ).apply( matched.elem, args );
|
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
|
||||||
|
.apply( matched.elem, args );
|
||||||
|
|
||||||
if ( ret !== undefined ) {
|
if ( ret !== undefined ) {
|
||||||
event.result = ret;
|
event.result = ret;
|
||||||
@ -728,7 +728,7 @@ jQuery.each({
|
|||||||
mouseenter: "mouseover",
|
mouseenter: "mouseover",
|
||||||
mouseleave: "mouseout"
|
mouseleave: "mouseout"
|
||||||
}, function( orig, fix ) {
|
}, function( orig, fix ) {
|
||||||
jQuery.event.special[ orig ] = jQuery.event.special[ fix ] = {
|
jQuery.event.special[ orig ] = {
|
||||||
delegateType: fix,
|
delegateType: fix,
|
||||||
bindType: fix,
|
bindType: fix,
|
||||||
|
|
||||||
@ -737,16 +737,14 @@ jQuery.each({
|
|||||||
related = event.relatedTarget,
|
related = event.relatedTarget,
|
||||||
handleObj = event.handleObj,
|
handleObj = event.handleObj,
|
||||||
selector = handleObj.selector,
|
selector = handleObj.selector,
|
||||||
oldType, ret;
|
ret;
|
||||||
|
|
||||||
// For a real mouseover/out, always call the handler; for
|
// For mousenter/leave call the handler if related is outside the target.
|
||||||
// mousenter/leave call the handler if related is outside the target.
|
|
||||||
// NB: No relatedTarget if the mouse left/entered the browser window
|
// NB: No relatedTarget if the mouse left/entered the browser window
|
||||||
if ( !related || handleObj.origType === event.type || (related !== target && !jQuery.contains( target, related )) ) {
|
if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
|
||||||
oldType = event.type;
|
|
||||||
event.type = handleObj.origType;
|
event.type = handleObj.origType;
|
||||||
ret = handleObj.handler.apply( this, arguments );
|
ret = handleObj.handler.apply( this, arguments );
|
||||||
event.type = oldType;
|
event.type = fix;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user