Fix #13150, .has() w/o args checks for any callbacks. Close gh-1111.

This commit is contained in:
adamcoulombe
2013-01-03 17:05:00 -05:00
committed by Dave Methvin
parent 64b55f0b79
commit 54fc5fdfa2
2 changed files with 50 additions and 2 deletions

View File

@@ -137,9 +137,10 @@ jQuery.Callbacks = function( options ) {
}
return this;
},
// Control if a given callback is in the list
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function( fn ) {
return jQuery.inArray( fn, list ) > -1;
return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
},
// Remove all callbacks from the list
empty: function() {