Commits

Julian Aubourg committed 0618710

Properly resets firingLength when emptying the list. Fixes #13517

  • Participants
  • Parent commits 1b6be73

Comments (0)

Files changed (2)

File src/callbacks.js

 			// Remove all callbacks from the list
 			empty: function() {
 				list = [];
+				firingLength = 0;
 				return this;
 			},
 			// Have the list do nothing anymore

File test/unit/callbacks.js

 					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 );