1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-12 16:44:17 +02:00
This commit is contained in:
Mark Otto
2018-09-17 12:34:34 -07:00
parent 928ebd8925
commit b68ea572da
27 changed files with 97 additions and 167 deletions

16
js/dist/collapse.js vendored
View File

@@ -171,7 +171,11 @@
if (this._parent) {
actives = [].slice.call(this._parent.querySelectorAll(Selector.ACTIVES)).filter(function (elem) {
return elem.getAttribute('data-parent') === _this._config.parent;
if (typeof _this._config.parent === 'string') {
return elem.getAttribute('data-parent') === _this._config.parent;
}
return elem.classList.contains(ClassName.COLLAPSE);
});
if (actives.length === 0) {
@@ -308,7 +312,7 @@
_proto._getParent = function _getParent() {
var _this3 = this;
var parent = null;
var parent;
if (Util.isElement(this._config.parent)) {
parent = this._config.parent; // It's a jQuery object
@@ -329,12 +333,10 @@
};
_proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
if (element) {
var isOpen = $$$1(element).hasClass(ClassName.SHOW);
var isOpen = $$$1(element).hasClass(ClassName.SHOW);
if (triggerArray.length) {
$$$1(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
}
if (triggerArray.length) {
$$$1(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
}
}; // Static

File diff suppressed because one or more lines are too long

17
js/dist/util.js vendored
View File

@@ -79,24 +79,13 @@
},
getSelectorFromElement: function getSelectorFromElement(element) {
var selector = element.getAttribute('data-target');
var method = 'querySelector';
if (!selector || selector === '#') {
selector = (element.getAttribute('href') || '').trim();
var hrefAttr = element.getAttribute('href');
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
}
var validSelector = selector;
if (selector.charAt(0) === '#' && selector.indexOf(',') === -1) {
selector = selector.substr(1);
method = 'getElementById';
}
try {
return document[method](selector) ? validSelector : null;
} catch (err) {
return null;
}
return selector && document.querySelector(selector) ? selector : null;
},
getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
if (!element) {

2
js/dist/util.js.map vendored

File diff suppressed because one or more lines are too long