1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-29 06:49:06 +02:00

Collapse - Allow to pass jQuery object or DOM element to the parent option

This commit is contained in:
Johann-S
2017-09-25 12:41:54 +02:00
parent 3abf8a0e55
commit 9b8356ba52
4 changed files with 64 additions and 9 deletions

View File

@@ -32,10 +32,6 @@ const Util = (() => {
return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase()
}
function isElement(obj) {
return (obj[0] || obj).nodeType
}
function getSpecialTransitionEndEvent() {
return {
bindType: transition.end,
@@ -138,12 +134,16 @@ const Util = (() => {
return Boolean(transition)
},
isElement(obj) {
return (obj[0] || obj).nodeType
},
typeCheckConfig(componentName, config, configTypes) {
for (const property in configTypes) {
if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
const expectedTypes = configTypes[property]
const value = config[property]
const valueType = value && isElement(value) ?
const valueType = value && Util.isElement(value) ?
'element' : toType(value)
if (!new RegExp(expectedTypes).test(valueType)) {