-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Open
Description
Check that first: event/trigger.js#L32
Note that it depends of jQuery.event.triggered, but not check if it contains a valid value (in some cases, it is undefined, then any concat will return something like clickundefined). Maybe the best implementation to avoid regular expression checking if something like that:
if ( jQuery.event.triggered && rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
Another thing to consider is that this branch is less common that the next one: event/trigger.js#L36
if ( type.indexOf( "." ) > -1 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split( "." );
type = namespaces.shift();
namespaces.sort();
}
Then, in this case, we can just turn the first branch on a else if, like that:
if ( type.indexOf( "." ) > -1 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split( "." );
type = namespaces.shift();
namespaces.sort();
}
else if ( jQuery.event.triggered && rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
Lastly, I not found any test over this branch. It continues valid/available/working on 3.0? Even if I remove this branch it continues passing on all tests.