mirror of
https://github.com/jquery/jquery.git
synced 2026-02-03 22:05:00 -05:00
Fix #13471. $().on(".xyz"...) should avoid later crash.
If the event type is an empty string we end up hanging in .off() which makes for mighty hard debugging. Instead treat it as a no-op. Docs seem clear this is not allowed.
This commit is contained in:
@@ -66,6 +66,11 @@ jQuery.event = {
|
||||
tmp = rtypenamespace.exec( types[t] ) || [];
|
||||
type = origType = tmp[1];
|
||||
namespaces = ( tmp[2] || "" ).split( "." ).sort();
|
||||
|
||||
// There *must* be a type, no attaching namespace-only handlers
|
||||
if ( !type ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// If event changes its type, use the special event handlers for the changed type
|
||||
special = jQuery.event.special[ type ] || {};
|
||||
|
||||
Reference in New Issue
Block a user