From bba67df74722517c3db4d4daa7df6124a6767ede Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 28 Aug 2009 00:39:43 +0000 Subject: [PATCH] Widget factory: Added support for deep extending multiple option hashes on init. --- tests/unit/core/core.js | 20 +++++++++++++++++--- ui/ui.core.js | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) 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 -- 2.39.5