Widget factory: Added support for deep extending multiple option hashes on init.

This commit is contained in:
Scott González 2009-08-28 00:39:43 +00:00
parent 6c6218fa12
commit bba67df747
2 changed files with 18 additions and 4 deletions

View 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"
}
});
});

View 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