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

Various fixes to increase parity with jQuery API #21

Merged
merged 4 commits into from Nov 16, 2015

Conversation

lelandrichardson
Copy link
Collaborator

Couple of things in this PR:

  1. Added optional selector argument to .children() (Issue Add an optional arg to .children() to filter the results by a selector #5)
  2. Added optional selector argument to .parents()
  3. Refactored .parent() to work when called on wrapper with multiple nodes (Issue Make .parent() work for non-single node wrappers #10)
  4. Refactored .closest() to include testing itself (BREAKING CHANGE) (Issue Should .closest() include the node it's being called on for parity with jQuery? #8)

@lelandrichardson lelandrichardson added the semver: major Breaking changes label Nov 16, 2015

Note: can only be called on a wrapper of a single node.


#### Arguments

1. `selector` (`String|Function` [optional]): The selector to filter the parents by.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the documentation above doesn't talk about what arguments the function would take, and what it'd return?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added:

Optionally, a selector can be provided and it will filter the parents by this selector

Does that not do what you're meaning?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That talks about String but not Function (in the type signature)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the context of reagent, a "selector" can be a function in addition to a string. More specifically, if it is a function it assumes you are passing in a valid react component constructor and will select for that. In this documentation, every "selector" argument has a type signature of String|Function

@lelandrichardson lelandrichardson force-pushed the lmr/jquery-parity-parents-closest-children branch from 63b9f0e to 6616eb1 Compare November 16, 2015 16:40
@ljharb
Copy link
Member

ljharb commented Nov 16, 2015

LGTM

lelandrichardson added a commit that referenced this pull request Nov 16, 2015
…children

Various fixes to increase parity with jQuery API
@lelandrichardson lelandrichardson merged commit 0134ebf into master Nov 16, 2015
@lelandrichardson lelandrichardson deleted the lmr/jquery-parity-parents-closest-children branch November 16, 2015 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: major Breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants