@@ -65,7 +65,7 @@ jQuery.each( tests, function( strFlags, resultString ) {
6565
6666 test ( "jQuery.Callbacks( " + showFlags ( flags ) + " ) - " + filterLabel , function ( ) {
6767
68- expect ( 28 ) ;
68+ expect ( 29 ) ;
6969
7070 var cblist ,
7171 results = resultString . split ( / \s + / ) ;
@@ -94,7 +94,7 @@ jQuery.each( tests, function( strFlags, resultString ) {
9494 strictEqual ( cblist . disabled ( ) , true , ".disabled() becomes true" ) ;
9595 strictEqual ( cblist . locked ( ) , true , "disabling locks" ) ;
9696
97- // #13517 - Emptying while firing
97+ // Emptying while firing (#13517)
9898 cblist = jQuery . Callbacks ( flags ) ;
9999 cblist . add ( cblist . empty ) ;
100100 cblist . add ( function ( ) {
@@ -164,6 +164,16 @@ jQuery.each( tests, function( strFlags, resultString ) {
164164 strictEqual ( output , "X" , "Lock early" ) ;
165165 strictEqual ( cblist . locked ( ) , true , "Locking reflected in accessor" ) ;
166166
167+ // Locking while firing (gh-1990)
168+ output = "X" ;
169+ cblist = jQuery . Callbacks ( flags ) ;
170+ cblist . add ( cblist . lock ) ;
171+ cblist . add ( function ( str ) {
172+ output += str ;
173+ } ) ;
174+ cblist . fire ( "A" ) ;
175+ strictEqual ( output , "XA" , "Locking doesn't abort execution (gh-1990)" ) ;
176+
167177 // Ordering
168178 output = "X" ;
169179 cblist = jQuery . Callbacks ( flags ) ;
@@ -331,8 +341,6 @@ test( "jQuery.Callbacks.has", function() {
331341 strictEqual ( cb . has ( ) , true , "Check if unique list has callback function(s) attached" ) ;
332342 cb . lock ( ) ;
333343 strictEqual ( cb . has ( ) , false , "locked() list is empty and returns false" ) ;
334-
335-
336344} ) ;
337345
338346test ( "jQuery.Callbacks() - adding a string doesn't cause a stack overflow" , function ( ) {
0 commit comments