mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-30 00:29:52 +02:00
Extend SelectorEngine.find()
to include an element
first arg.
If not supplied, it'll just use `document`.
This commit is contained in:
@@ -46,7 +46,7 @@ const SelectorEngine = {
|
|||||||
return fnMatches.call(element, selector)
|
return fnMatches.call(element, selector)
|
||||||
},
|
},
|
||||||
|
|
||||||
find(selector) {
|
find(element = document, selector) {
|
||||||
if (typeof selector !== 'string') {
|
if (typeof selector !== 'string') {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ const SelectorEngine = {
|
|||||||
selectorType = 'getElementById'
|
selectorType = 'getElementById'
|
||||||
selector = selector.substr(1, selector.length)
|
selector = selector.substr(1, selector.length)
|
||||||
}
|
}
|
||||||
return document[selectorType](selector)
|
return element[selectorType](selector)
|
||||||
},
|
},
|
||||||
|
|
||||||
closest(element, selector) {
|
closest(element, selector) {
|
||||||
|
Reference in New Issue
Block a user