Extend SelectorEngine.find() to include an element first arg.
If not supplied, it'll just use `document`.
This commit is contained in:
parent
3664d14908
commit
3e8bc9d9ec
1 changed files with 2 additions and 2 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue