diff options
Diffstat (limited to 'js/dist/util.js')
-rw-r--r-- | js/dist/util.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/js/dist/util.js b/js/dist/util.js index 2fda21d535..6eadcc31b9 100644 --- a/js/dist/util.js +++ b/js/dist/util.js @@ -111,13 +111,16 @@ var Util = function ($) { }, getSelectorFromElement: function getSelectorFromElement(element) { var 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 { + var $selector = $(selector); + return $selector.length > 0 ? selector : null; + } catch (error) { + return null; + } }, reflow: function reflow(element) { return element.offsetHeight; |