mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Widget factory: Added support for deep extending multiple option hashes on init.
This commit is contained in:
parent
6c6218fa12
commit
bba67df747
@ -65,17 +65,31 @@ test('widget factory, merge multiple option arguments', function() {
|
|||||||
disabled: false,
|
disabled: false,
|
||||||
option1: "value1",
|
option1: "value1",
|
||||||
option2: "value2",
|
option2: "value2",
|
||||||
option3: "value3"
|
option3: "value3",
|
||||||
|
option4: {
|
||||||
|
option4a: "valuea",
|
||||||
|
option4b: "valueb"
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("#main > :first").widgetTest({
|
$("#main > :first").widgetTest({
|
||||||
option1: "valuex",
|
option1: "valuex",
|
||||||
option2: "valuex",
|
option2: "valuex",
|
||||||
option3: "value3"
|
option3: "value3",
|
||||||
|
option4: {
|
||||||
|
option4a: "valuex"
|
||||||
|
}
|
||||||
}, {
|
}, {
|
||||||
option1: "value1",
|
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
|
// allow multiple hashes to be passed on init
|
||||||
options = !isMethodCall && args.length
|
options = !isMethodCall && args.length
|
||||||
? $.extend.apply(null, arguments)
|
? $.extend.apply(null, [true, options].concat(args))
|
||||||
: options;
|
: options;
|
||||||
|
|
||||||
// prevent calls to internal methods
|
// prevent calls to internal methods
|
||||||
|
Loading…
Reference in New Issue
Block a user