Skip to content
Permalink
Browse files

jquery event: closes #3355. Added stopImmediatePropagation() to events.

  • Loading branch information
flesler committed Oct 18, 2008
1 parent 63bfe1d commit aa9236e5ea8c91fbf60d440872e4946a0452f852
Showing with 13 additions and 1 deletion.
  1. +13 −1 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

0 comments on commit aa9236e

Please sign in to comment.
You can’t perform that action at this time.