Commit a14a3172 authored by jaubourg's avatar jaubourg

Properly resets firingLength when emptying the list. Fixes #13517

parent b6cfc043
...@@ -145,6 +145,7 @@ jQuery.Callbacks = function( options ) { ...@@ -145,6 +145,7 @@ jQuery.Callbacks = function( options ) {
// Remove all callbacks from the list // Remove all callbacks from the list
empty: function() { empty: function() {
list = []; list = [];
firingLength = 0;
return this; return this;
}, },
// Have the list do nothing anymore // Have the list do nothing anymore
......
...@@ -92,6 +92,22 @@ jQuery.each( tests, function( strFlags, resultString ) { ...@@ -92,6 +92,22 @@ jQuery.each( tests, function( strFlags, resultString ) {
cblist.fire("A"); cblist.fire("A");
strictEqual( output, "X", "Firing after disabling" ); 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) // Basic binding and firing (context, arguments)
output = "X"; output = "X";
cblist = jQuery.Callbacks( flags ); cblist = jQuery.Callbacks( flags );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment