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

change .getClosest to include the node itself #2111

Closed
ianstormtaylor opened this issue Aug 22, 2018 · 3 comments
Closed

change .getClosest to include the node itself #2111

ianstormtaylor opened this issue Aug 22, 2018 · 3 comments

Comments

@ianstormtaylor
Copy link
Owner

Do you want to request a feature or report a bug?

Bug.

What's the current behavior?

Right now the .getClosest method doesn't return the node itself if it matches the iterator. This is confusing because it's different than the behavior of the DOM's native el.closest API.

What's the expected behavior?

It should return the node itself if it matches too.

@Dundercover
Copy link
Contributor

Are you saying that these methods also need to change?

  • getClosestBlock
  • getClosestInline
  • getClosestVoid

@ianstormtaylor
Copy link
Owner Author

@Dundercover yup, they'd need to do the same for consistency. We can always add a getClosestAncestor* if people find it a big enough use case, but I'd like the base API to match the browser's semantics.

@ianstormtaylor
Copy link
Owner Author

Fixed by #3093.

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

Successfully merging a pull request may close this issue.

2 participants