Make domLense error on non-element targets
This commit is contained in:
parent
44b6343de6
commit
1c03da8815
1 changed files with 4 additions and 3 deletions
|
@ -12,8 +12,6 @@ class ChildObserver extends MutationObserver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const childObserver = new ChildObserver()
|
|
||||||
|
|
||||||
export const lense = (methods, extra) => {
|
export const lense = (methods, extra) => {
|
||||||
if (extra) return lense(extra)(methods)
|
if (extra) return lense(extra)(methods)
|
||||||
|
|
||||||
|
@ -70,7 +68,10 @@ export const lense = (methods, extra) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return element => new Proxy(element, traps)
|
return element => {
|
||||||
|
if (!(element instanceof Element)) throw(new Error("Creating domLense on non-element"))
|
||||||
|
return new Proxy(element, traps)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default lense
|
export default lense
|
||||||
|
|
Loading…
Reference in a new issue