mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Fix #10705. Don't bail too soon in .off()
event string processing.
This commit is contained in:
parent
654930de21
commit
dd363d2c0f
@ -76,7 +76,7 @@ jQuery.event = {
|
||||
|
||||
// Handle multiple events separated by a space
|
||||
// jQuery(...).bind("mouseover mouseout", fn);
|
||||
types = hoverHack(types).split( " " );
|
||||
types = jQuery.trim( hoverHack(types) ).split( " " );
|
||||
for ( t = 0; t < types.length; t++ ) {
|
||||
|
||||
tns = rtypenamespace.exec( types[t] ) || [];
|
||||
@ -159,7 +159,7 @@ jQuery.event = {
|
||||
}
|
||||
|
||||
// Once for each type.namespace in types; type may be omitted
|
||||
types = hoverHack( types || "" ).split(" ");
|
||||
types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
|
||||
for ( t = 0; t < types.length; t++ ) {
|
||||
tns = rtypenamespace.exec( types[t] ) || [];
|
||||
type = tns[1];
|
||||
@ -171,7 +171,7 @@ jQuery.event = {
|
||||
for ( j in events ) {
|
||||
jQuery.event.remove( elem, j + namespaces, handler, selector );
|
||||
}
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
special = jQuery.event.special[ type ] || {};
|
||||
|
@ -2458,6 +2458,30 @@ test(".on and .off", function() {
|
||||
jQuery("#onandoff").remove();
|
||||
});
|
||||
|
||||
|
||||
test(".on and .off, selective mixed removal (#10705)", function() {
|
||||
expect(7);
|
||||
|
||||
var clockout = 0,
|
||||
timingx = function( e ) {
|
||||
ok( true, "triggered " + e.type );
|
||||
};
|
||||
|
||||
jQuery( '<p>Strange Pursuit</p>' )
|
||||
.on( "click", timingx )
|
||||
.on( "click.duty", timingx )
|
||||
.on( "click.now", timingx )
|
||||
.on( "devo", timingx )
|
||||
.on( "future", timingx )
|
||||
.trigger( "click" ) // 3
|
||||
.trigger( "devo" ) // 1
|
||||
.off( ".duty devo " ) // trailing space
|
||||
.trigger( "future" ) // 1
|
||||
.trigger( "click" ) // 2
|
||||
.off( "future click" )
|
||||
.trigger( "click" ); // 0
|
||||
});
|
||||
|
||||
test("delegated events quickIs", function() {
|
||||
expect(14);
|
||||
var markup = jQuery(
|
||||
|
Loading…
Reference in New Issue
Block a user