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

Remember parentNode in case onChange callback mutates DOM #227

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

botandrose
Copy link
Contributor

There's no guarantee that the onChange callback won't mutate the DOM in some way that removes the selected option node, thus creating a runtime error when null.dispatchEvent is called when trying to trigger the "blur" event on the parent. By saving the parentNode in a variable, we avoid this edge-case scenario.

@botandrose
Copy link
Contributor Author

The test failures seem unrelated to me.

There's no guarantee that the onChange callback won't mutate the DOM in some way that removes the selected option node, thus creating a runtime error when null.dispatchEvent is called when trying to trigger the "blur" event on the parent. By saving the parentNode in a variable, we avoid this edge-case scenario.
@botandrose
Copy link
Contributor Author

I saw that a new version was released, so I rebased this PR, and its green now.

@route
Copy link
Member

route commented Nov 9, 2023

Wow awesome, didn't think about this scenario. Thanks!

@route route merged commit 449d115 into rubycdp:main Nov 9, 2023
6 checks passed
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