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 'js/dist/util.js')
-rw-r--r--js/dist/util.js12
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 {