Uses a copy of the flags when they are given as an object rather than the object itself. That way, we're sure flags are immutable for the entire lifetime of the Callbacks instance.

This commit is contained in:
jaubourg 2012-04-25 02:06:21 +02:00
parent 54fab3174c
commit ad329384ff

View File

@ -40,7 +40,7 @@ jQuery.Callbacks = function( flags ) {
// Convert flags from String-formatted to Object-formatted if needed
// (we check in cache first)
flags = typeof flags === "string" ? ( flagsCache[ flags ] || createFlags( flags ) ) : ( flags || {} );
flags = typeof flags === "string" ? ( flagsCache[ flags ] || createFlags( flags ) ) : jQuery.extend( {}, flags );
var // Actual callback list
list = [],