Skip to content
Permalink
Browse files

Widget factory: Added support for deep extending multiple option hash…

…es on init.
  • Loading branch information...
scottgonzalez committed Aug 28, 2009
1 parent 6c6218f commit bba67df74722517c3db4d4daa7df6124a6767ede
Showing with 18 additions and 4 deletions.
  1. +17 −3 tests/unit/core/core.js
  2. +1 −1 ui/ui.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"
}
});
});

@@ -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

0 comments on commit bba67df

Please sign in to comment.
You can’t perform that action at this time.