]> source.dussan.org Git - jquery-ui.git/commitdiff
Widget factory: Added support for deep extending multiple option hashes on init.
authorScott González <scott.gonzalez@gmail.com>
Fri, 28 Aug 2009 00:39:43 +0000 (00:39 +0000)
committerScott González <scott.gonzalez@gmail.com>
Fri, 28 Aug 2009 00:39:43 +0000 (00:39 +0000)
tests/unit/core/core.js
ui/ui.core.js

index 232b9506120e2c57919f8321010fffa9c1ebbb7d..71f8c5845e5d5450aa3d484f6c8a23e75377a413 100644 (file)
@@ -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"
+               }
        });
 });
 
index 37f1f09e9820fd69850b856bfab5148a9d842904..a83618a45a729d47a1b19dd54f9af078e7d7996c 100644 (file)
@@ -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