From: Scott González Date: Fri, 28 Aug 2009 00:39:43 +0000 (+0000) Subject: Widget factory: Added support for deep extending multiple option hashes on init. X-Git-Tag: 1.8a2~125 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bba67df74722517c3db4d4daa7df6124a6767ede;p=jquery-ui.git Widget factory: Added support for deep extending multiple option hashes on init. --- diff --git a/tests/unit/core/core.js b/tests/unit/core/core.js index 232b95061..71f8c5845 100644 --- a/tests/unit/core/core.js +++ b/tests/unit/core/core.js @@ -65,17 +65,31 @@ test('widget factory, merge multiple option arguments', function() { disabled: false, option1: "value1", option2: "value2", - option3: "value3" + option3: "value3", + option4: { + option4a: "valuea", + option4b: "valueb" + } }); } }); $("#main > :first").widgetTest({ option1: "valuex", option2: "valuex", - option3: "value3" + option3: "value3", + option4: { + option4a: "valuex" + } }, { option1: "value1", - option2: "value2" + option2: "value2", + option4: { + option4b: "valueb" + } + }, { + option4: { + option4a: "valuea" + } }); }); diff --git a/ui/ui.core.js b/ui/ui.core.js index 37f1f09e9..a83618a45 100644 --- a/ui/ui.core.js +++ b/ui/ui.core.js @@ -255,7 +255,7 @@ $.widget = function(name, prototype) { // allow multiple hashes to be passed on init options = !isMethodCall && args.length - ? $.extend.apply(null, arguments) + ? $.extend.apply(null, [true, options].concat(args)) : options; // prevent calls to internal methods