mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Properly resets firingLength when emptying the list. Fixes #13517
This commit is contained in:
parent
b6cfc0438e
commit
a14a31727f
@ -145,6 +145,7 @@ jQuery.Callbacks = function( options ) {
|
||||
// Remove all callbacks from the list
|
||||
empty: function() {
|
||||
list = [];
|
||||
firingLength = 0;
|
||||
return this;
|
||||
},
|
||||
// Have the list do nothing anymore
|
||||
|
@ -92,6 +92,22 @@ jQuery.each( tests, function( strFlags, resultString ) {
|
||||
cblist.fire("A");
|
||||
strictEqual( output, "X", "Firing after disabling" );
|
||||
|
||||
// #13517 - Emptying while firing
|
||||
cblist = jQuery.Callbacks( flags );
|
||||
cblist.add( cblist.empty );
|
||||
cblist.add( function() {
|
||||
ok( false, "not emptied" );
|
||||
} );
|
||||
cblist.fire();
|
||||
|
||||
// Disabling while firing
|
||||
cblist = jQuery.Callbacks( flags );
|
||||
cblist.add( cblist.disable );
|
||||
cblist.add( function() {
|
||||
ok( false, "not disabled" );
|
||||
} );
|
||||
cblist.fire();
|
||||
|
||||
// Basic binding and firing (context, arguments)
|
||||
output = "X";
|
||||
cblist = jQuery.Callbacks( flags );
|
||||
|
Loading…
Reference in New Issue
Block a user