Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fall back to empty siblings list if no parentNode is present #566

Conversation

julianrubisch
Copy link
Contributor

Bug Fix

Description

When combining updates_for with a page or selector morph, a race condition could occur where SR's elementToXPath would try to parse a document fragment that's not yet connected to the DOM as part of updates_for's morphing process. Traversing up the tree, such an element would have no parentNode and thus no siblings.

This PR fixes it by falling back to an empty siblings array should that occur.

Checklist

  • My code follows the style guidelines of this project
  • Checks (StandardRB & Prettier-Standard) are passing
  • This is not a documentation update

@leastbad leastbad merged commit c91a86d into stimulusreflex:master Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants