aboutsummaryrefslogtreecommitdiffstats
path: root/src/callbacks.js
diff options
context:
space:
mode:
authorjaubourg <j@ubourg.net>2012-08-16 19:12:59 +0200
committerjaubourg <j@ubourg.net>2012-08-16 19:12:59 +0200
commit9d07525a71e7bc12f606d8015d21425c5580e262 (patch)
treec10b8a4d577ac21e8bafef17f6dbb174402e734d /src/callbacks.js
parentb292c4c2df673d17d8c720e13d4d81ecae4ec499 (diff)
downloadjquery-9d07525a71e7bc12f606d8015d21425c5580e262.tar.gz
jquery-9d07525a71e7bc12f606d8015d21425c5580e262.zip
Makes sure "adding" a string to a Callbacks object doesn't cause a stack overflow, just ignore the value like 1.7.x righfully did. Fixes #12233. Unit tests added.
Diffstat (limited to 'src/callbacks.js')
-rw-r--r--src/callbacks.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/callbacks.js b/src/callbacks.js
index 893f5760b..37acabcba 100644
--- a/src/callbacks.js
+++ b/src/callbacks.js
@@ -92,9 +92,10 @@ jQuery.Callbacks = function( options ) {
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 );
}