mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-28 14:29:07 +02:00
Object spread : less jQuery more ES6 (#24665)
This commit is contained in:
@@ -277,7 +277,10 @@ const Collapse = (($) => {
|
||||
// private
|
||||
|
||||
_getConfig(config) {
|
||||
config = $.extend({}, Default, config)
|
||||
config = {
|
||||
...Default,
|
||||
...config
|
||||
}
|
||||
config.toggle = Boolean(config.toggle) // coerce string values
|
||||
Util.typeCheckConfig(NAME, config, DefaultType)
|
||||
return config
|
||||
@@ -338,12 +341,11 @@ const Collapse = (($) => {
|
||||
return this.each(function () {
|
||||
const $this = $(this)
|
||||
let data = $this.data(DATA_KEY)
|
||||
const _config = $.extend(
|
||||
{},
|
||||
Default,
|
||||
$this.data(),
|
||||
typeof config === 'object' && config
|
||||
)
|
||||
const _config = {
|
||||
...Default,
|
||||
...$this.data(),
|
||||
...typeof config === 'object' && config
|
||||
}
|
||||
|
||||
if (!data && _config.toggle && /show|hide/.test(config)) {
|
||||
_config.toggle = false
|
||||
|
Reference in New Issue
Block a user