Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dist/js/bootstrap.bundle.js')
-rw-r--r--dist/js/bootstrap.bundle.js33
1 files changed, 12 insertions, 21 deletions
diff --git a/dist/js/bootstrap.bundle.js b/dist/js/bootstrap.bundle.js
index b21bb07c79..17374b0e91 100644
--- a/dist/js/bootstrap.bundle.js
+++ b/dist/js/bootstrap.bundle.js
@@ -140,24 +140,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) {
@@ -1164,7 +1153,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) {
@@ -1301,7 +1294,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
@@ -1322,12 +1315,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