Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Properly resets firingLength when emptying the list. Fixes #13517

  • Loading branch information...
commit 0618710913f41d7a7f4c095f0edda035e65a887d 1 parent 1b6be73
@jaubourg jaubourg authored
Showing with 17 additions and 0 deletions.
  1. +1 −0  src/callbacks.js
  2. +16 −0 test/unit/callbacks.js
View
1  src/callbacks.js
@@ -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
View
16 test/unit/callbacks.js
@@ -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 );
Please sign in to comment.
Something went wrong with that request. Please try again.