Allows traditional options object for $.Callbacks flags. Fixes #11011. Unit tests added.

This commit is contained in:
jaubourg
2012-04-02 01:03:34 +02:00
parent a29d482894
commit 7fa0da08b8
2 changed files with 151 additions and 129 deletions

View File

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