mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
jquery event: closes #3355. Added stopImmediatePropagation() to events.
This commit is contained in:
parent
63bfe1ded1
commit
aa9236e5ea
14
src/event.js
14
src/event.js
@ -190,6 +190,7 @@ jQuery.event = {
|
||||
target: elem,
|
||||
preventDefault: function(){},
|
||||
stopPropagation: function(){},
|
||||
stopImmediatePropagation:stopImmediatePropagation,
|
||||
timeStamp: now()
|
||||
});
|
||||
data[0][expando] = true; // no need to fix fake event
|
||||
@ -271,6 +272,10 @@ jQuery.event = {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
if( event._sip )
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,7 +285,7 @@ jQuery.event = {
|
||||
props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" "),
|
||||
|
||||
fix: function(event) {
|
||||
if ( event[expando] == true )
|
||||
if ( event[expando] )
|
||||
return event;
|
||||
|
||||
// store a copy of the original event object
|
||||
@ -313,6 +318,8 @@ jQuery.event = {
|
||||
originalEvent.cancelBubble = true;
|
||||
};
|
||||
|
||||
event.stopImmediatePropagation = stopImmediatePropagation;
|
||||
|
||||
// Fix timeStamp
|
||||
event.timeStamp = event.timeStamp || now();
|
||||
|
||||
@ -367,6 +374,11 @@ jQuery.event = {
|
||||
}
|
||||
};
|
||||
|
||||
function stopImmediatePropagation(){
|
||||
this._sip = 1;
|
||||
this.stopPropagation();
|
||||
}
|
||||
|
||||
if ( !jQuery.browser.msie ){
|
||||
// Checks if an event happened on an element within another element
|
||||
// Used in jQuery.event.special.mouseenter and mouseleave handlers
|
||||
|
Loading…
Reference in New Issue
Block a user