aboutsummaryrefslogtreecommitdiff
path: root/dist/js/bootstrap.js
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2018-08-18 20:22:08 -0700
committerMark Otto <[email protected]>2018-08-18 20:22:08 -0700
commitc0fd91788ee16ef013fe7201c069cfcfef7d0af9 (patch)
tree9f2992512c0015338dd804131cbcdba348b4535b /dist/js/bootstrap.js
parentab7ce480f254d70dba1a47a955897d0c29e660bf (diff)
downloadbootstrap-c0fd91788ee16ef013fe7201c069cfcfef7d0af9.tar.xz
bootstrap-c0fd91788ee16ef013fe7201c069cfcfef7d0af9.zip
dist
Diffstat (limited to 'dist/js/bootstrap.js')
-rw-r--r--dist/js/bootstrap.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js
index af3e1bf0b..fe19a1086 100644
--- a/dist/js/bootstrap.js
+++ b/dist/js/bootstrap.js
@@ -141,13 +141,21 @@
},
getSelectorFromElement: function getSelectorFromElement(element) {
var selector = element.getAttribute('data-target');
+ var method = 'querySelector';
if (!selector || selector === '#') {
- selector = element.getAttribute('href') || '';
+ selector = (element.getAttribute('href') || '').trim();
+ }
+
+ var validSelector = selector;
+
+ if (selector.charAt(0) === '#' && selector.indexOf(',') === -1) {
+ selector = selector.substr(1);
+ method = 'getElementById';
}
try {
- return document.querySelector(selector) ? selector : null;
+ return document[method](selector) ? validSelector : null;
} catch (err) {
return null;
}
@@ -3260,7 +3268,7 @@
var _config = typeof config === 'object' ? config : null;
- if (!data && /destroy|hide/.test(config)) {
+ if (!data && /dispose|hide/.test(config)) {
return;
}