mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-01 13:24:25 +01:00
Fix getSelectorFromElement when # is a selector (#21615)
* Fix getSelectorFromElement when # is a selector * Thanks to @vanduynslagerp remove regex to validate selector
This commit is contained in:
parent
f2f8051285
commit
f2f2e39a45
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user