diff options
author | Mark Otto <markdotto@gmail.com> | 2017-11-08 07:45:26 +0300 |
---|---|---|
committer | Mark Otto <markdotto@gmail.com> | 2017-11-08 07:45:26 +0300 |
commit | 9c213b7f27295cd12774b550087720f002a6787e (patch) | |
tree | 41ebbe69350d9ce98f39f201b7f03d451d684388 /js/dist/util.js | |
parent | 9deb1c677cc77a2bd2db03bacc8d2f271c772671 (diff) |
upgrade to node 8.9.x and dist
Diffstat (limited to 'js/dist/util.js')
-rw-r--r-- | js/dist/util.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/js/dist/util.js b/js/dist/util.js index 19a612a7f2..f64c55cbf7 100644 --- a/js/dist/util.js +++ b/js/dist/util.js @@ -77,6 +77,13 @@ var Util = function ($) { $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); } } + + function escapeId(selector) { + // we escape IDs in case of special selectors (selector = '#myId:something') + // $.escapeSelector does not exist in jQuery < 3 + selector = typeof $.escapeSelector === 'function' ? $.escapeSelector(selector).substr(1) : selector.replace(/(:|\.|\[|\]|,|=|@)/g, '\\$1'); + return selector; + } /** * -------------------------------------------------------------------------- * Public Util Api @@ -99,6 +106,11 @@ var Util = function ($) { if (!selector || selector === '#') { selector = element.getAttribute('href') || ''; + } // if it's an ID + + + if (selector.charAt(0) === '#') { + selector = escapeId(selector); } try { |