-
Notifications
You must be signed in to change notification settings - Fork 58
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
Issue/1625 implement element closest #1626
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment (probably not a blocker). Also, is the gutenberg reference update related?
src/jsdom-patches.js
Outdated
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not super important, but I believe this should return null
if no matching element is found. I don't think it's likely, but in theory, someone could check for element.closest( selector ) === null
(instead of just checking that it's falsey). Currently, it'd return undefined
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch @mkevins !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense! Done with 919526c.
Not really. There are no Gutenberg side changes that are relevant. I included an update of the ref for making sure this fix does indeed fix the tests that only get broken if you update to a recent Gutenberg hash. Other than that, this can be considered a typical Gutenberg "bump" to master to bring in the latest. Would you prefer to just leave out the Gutenberg hash update @mkevins , now that we know the tests pass? |
Ready for another pass! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified this works as expected on the line where we were previously crashing when pasting with and without a <pre>
tag
No need I just wanted to make sure I wasn't missing anything. Thanks for the explanation, makes sense! |
Fixes #1625
Adds to the local jsdom patches the implementation of
Element.closest()
as seen at jsdom/jsdom#1555 (comment).Even though jsdom itself has had that function added already, the jsdom-jscore fork we are using is not up-to-date to use it. Updating the fork is far from trivial so, resorting to a local patch instead.
To test:
Update release notes:
RELEASE-NOTES.txt
.