aboutsummaryrefslogtreecommitdiff
path: root/js/src/util.js
diff options
context:
space:
mode:
authorGijs Boddeus <[email protected]>2017-08-15 23:43:36 +0200
committerGitHub <[email protected]>2017-08-15 23:43:36 +0200
commit06d4c6d273daf3eb84c9c5bb6306cecc9209304f (patch)
tree695d8fb5b2f414eae0bac032369f77285f594803 /js/src/util.js
parent1fb6d8c46a560e2e35295440721ba2929f9721b6 (diff)
parent7b873fa0a15c0fb62671f95e966656967c6fd9b4 (diff)
downloadbootstrap-06d4c6d273daf3eb84c9c5bb6306cecc9209304f.tar.xz
bootstrap-06d4c6d273daf3eb84c9c5bb6306cecc9209304f.zip
Merge pull request #1 from twbs/v4-dev
updating fork of BS to v4-beta1
Diffstat (limited to 'js/src/util.js')
-rw-r--r--js/src/util.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/js/src/util.js b/js/src/util.js
index 06424fbfe..387c7d2ed 100644
--- a/js/src/util.js
+++ b/js/src/util.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.0.0-alpha.5): util.js
+ * Bootstrap (v4.0.0-beta): util.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -112,13 +112,16 @@ const Util = (($) => {
getSelectorFromElement(element) {
let selector = element.getAttribute('data-target')
-
- if (!selector) {
+ if (!selector || selector === '#') {
selector = element.getAttribute('href') || ''
- selector = /^#[a-z]/i.test(selector) ? selector : null
}
- return selector
+ try {
+ const $selector = $(selector)
+ return $selector.length > 0 ? selector : null
+ } catch (error) {
+ return null
+ }
},
reflow(element) {