mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-09 23:26:40 +02:00
Second element of find and findOne should be optional, not the first one
This commit is contained in:
@@ -84,7 +84,7 @@ class Alert {
|
|||||||
let parent = false
|
let parent = false
|
||||||
|
|
||||||
if (selector) {
|
if (selector) {
|
||||||
parent = SelectorEngine.find(selector)[0]
|
parent = SelectorEngine.findOne(selector)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
|
@@ -46,19 +46,19 @@ const SelectorEngine = {
|
|||||||
return fnMatches.call(element, selector)
|
return fnMatches.call(element, selector)
|
||||||
},
|
},
|
||||||
|
|
||||||
find(element = document, selector) {
|
find(selector, element = document) {
|
||||||
if (typeof selector !== 'string') {
|
if (typeof selector !== 'string') {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selector.indexOf('#') === 0) {
|
if (selector.indexOf('#') === 0) {
|
||||||
return SelectorEngine.findOne(element, selector)
|
return SelectorEngine.findOne(selector, element)
|
||||||
}
|
}
|
||||||
|
|
||||||
return element.querySelectorAll(selector)
|
return element.querySelectorAll(selector)
|
||||||
},
|
},
|
||||||
|
|
||||||
findOne(element = document, selector) {
|
findOne(selector, element = document) {
|
||||||
if (typeof selector !== 'string') {
|
if (typeof selector !== 'string') {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user