From 7fa0da08b88534e486ddb7eb3752ef76467fb7dd Mon Sep 17 00:00:00 2001 From: jaubourg Date: Mon, 2 Apr 2012 01:03:34 +0200 Subject: Allows traditional options object for $.Callbacks flags. Fixes #11011. Unit tests added. --- src/callbacks.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/callbacks.js') diff --git a/src/callbacks.js b/src/callbacks.js index 387868604..20422c35a 100644 --- a/src/callbacks.js +++ b/src/callbacks.js @@ -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 = [], -- cgit v1.2.3