aboutsummaryrefslogtreecommitdiffstats
path: root/src/event.js
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2011-11-15 10:22:32 -0500
committerDave Methvin <dave.methvin@gmail.com>2011-11-15 10:23:24 -0500
commit6736dd7168ccd1e6d72aca2e3c89d685c5d9c63a (patch)
treef2361174e5b69f636a89972b276b06538623ea5e /src/event.js
parent20cbf1b123c9d54029b7d5f6fef2343793f274c2 (diff)
downloadjquery-6736dd7168ccd1e6d72aca2e3c89d685c5d9c63a.tar.gz
jquery-6736dd7168ccd1e6d72aca2e3c89d685c5d9c63a.zip
Fix #10794. .triggerHandler() should not .preventDefault().
This also provides a resolution for #10699.
Diffstat (limited to 'src/event.js')
-rw-r--r--src/event.js13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/event.js b/src/event.js
index d56c44a55..199110c00 100644
--- a/src/event.js
+++ b/src/event.js
@@ -281,11 +281,6 @@ jQuery.event = {
event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
- // triggerHandler() and global events don't bubble or run the default action
- if ( onlyHandlers || !elem ) {
- event.preventDefault();
- }
-
// Handle a global trigger
if ( !elem ) {
@@ -335,7 +330,7 @@ jQuery.event = {
}
// Fire handlers on the event path
- for ( i = 0; i < eventPath.length; i++ ) {
+ for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
cur = eventPath[i][0];
event.type = eventPath[i][1];
@@ -349,15 +344,11 @@ jQuery.event = {
if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) {
event.preventDefault();
}
-
- if ( event.isPropagationStopped() ) {
- break;
- }
}
event.type = type;
// If nobody prevented the default action, do it now
- if ( !event.isDefaultPrevented() ) {
+ if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {