1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-14 17:44:15 +02:00

Remove escaping selector and add a warning to inform folks to escape their selectors (#25390)

This commit is contained in:
Johann-S
2018-01-21 21:02:16 +01:00
committed by XhmikosR
parent db70164d13
commit 5a6be71791
3 changed files with 6 additions and 27 deletions

View File

@@ -72,15 +72,6 @@ const Util = (($) => {
}
}
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
@@ -105,11 +96,6 @@ const Util = (($) => {
selector = element.getAttribute('href') || ''
}
// If it's an ID
if (selector.charAt(0) === '#') {
selector = escapeId(selector)
}
try {
const $selector = $(document).find(selector)
return $selector.length > 0 ? selector : null