Skip to content

Page crash when plugin is included #152

Description

@bmagierskiZielonysklep

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
      }
   }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions