var start = list.length;
(function add( args ) {
jQuery.each( args, function( _, arg ) {
- if ( jQuery.isFunction( arg ) && ( !options.unique || !self.has( arg ) ) ) {
+ var type = jQuery.type( arg );
+ if ( type === "function" && ( !options.unique || !self.has( arg ) ) ) {
list.push( arg );
- } else if ( arg && arg.length ) {
+ } else if ( arg && arg.length && type !== "string" ) {
// Inspect recursively
add( arg );
}
ok( true, "end of test" );
}).remove( fn ).fire();
});
+
+test( "jQuery.Callbacks() - adding a string doesn't cause a stack overflow", function() {
+
+ expect( 1 );
+
+ jQuery.Callbacks().add( "hello world" );
+
+ ok( true, "no stack overflow" );
+});