Error message from dist:
Uncaught (in promise) TypeError: can't access property "parentNode", f is null
Solution: if(f === null) break;
Missing case when "currentParent" is null, cannot be just else statement, throws Error because null don't have parent in DOM :)
while (!rootFound) {
var parentType = type(currentParent)
// We've reached the document, which means there's no shadow DOM in use.
if (parentType === '[object HTMLDocument]') {
rootFound = true
// We're using a shadow DOM.
} else if (parentType === '[object ShadowRoot]') {
rootFound = true
shadowDom = currentParent
customElement = currentParent.host
// Focus up the chain to the next parent and keep iterating.
} else {
currentParent = currentParent.parentNode
}
}
Error message from dist:
Solution:
if(f === null) break;Missing case when "currentParent" is null, cannot be just else statement, throws Error because null don't have parent in DOM :)