throw error when folks try to use a bad selector
This commit is contained in:
parent
9efed82522
commit
a689120fd2
5 changed files with 44 additions and 54 deletions
|
|
@ -79,14 +79,11 @@ const Util = (($) => {
|
|||
let selector = element.getAttribute('data-target')
|
||||
|
||||
if (!selector || selector === '#') {
|
||||
selector = (element.getAttribute('href') || '').trim()
|
||||
const hrefAttr = element.getAttribute('href')
|
||||
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''
|
||||
}
|
||||
|
||||
try {
|
||||
return document.querySelector(selector) ? selector : null
|
||||
} catch (err) {
|
||||
return null
|
||||
}
|
||||
return selector && document.querySelector(selector) ? selector : null
|
||||
},
|
||||
|
||||
getTransitionDurationFromElement(element) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue