Commit 3e8bc9d9 authored by XhmikosR's avatar XhmikosR
Browse files

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

If not supplied, it'll just use `document`.
parent 3664d149
Showing with 2 additions and 2 deletions
+2 -2
...@@ -46,7 +46,7 @@ const SelectorEngine = { ...@@ -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 = { ...@@ -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) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment