0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-20 17:54:23 +01:00

Extend SelectorEngine.find() to include an element first arg.

If not supplied, it'll just use `document`.
This commit is contained in:
XhmikosR 2017-08-23 17:43:04 +03:00
parent 3664d14908
commit 3e8bc9d9ec

View File

@ -46,7 +46,7 @@ const SelectorEngine = {
return fnMatches.call(element, selector)
},
find(selector) {
find(element = document, selector) {
if (typeof selector !== 'string') {
return null
}
@ -56,7 +56,7 @@ const SelectorEngine = {
selectorType = 'getElementById'
selector = selector.substr(1, selector.length)
}
return document[selectorType](selector)
return element[selectorType](selector)
},
closest(element, selector) {