Skip to content

Added new method childrenCount complementary to child(int)#1291

Merged
jhy merged 1 commit into
jhy:masterfrom
literakl:master
Feb 2, 2020
Merged

Added new method childrenCount complementary to child(int)#1291
jhy merged 1 commit into
jhy:masterfrom
literakl:master

Conversation

@literakl

@literakl literakl commented Jan 1, 2020

Copy link
Copy Markdown
Contributor

There is no easy way in the Element to find out a number of children available via the method child(int). The method childNodeSize() acts on list of all children while child(int) acts on the filtered list of the children. This trivial patch adds new method childrenCount() that is complementary to child(int) as it works on the same filtered list. A unit test is provided.

My observation: https://stackoverflow.com/questions/59547574/jsoup-how-to-find-out-elements-size

Thank you for this wonderful library and for consideration of merging this proposal.

@literakl

literakl commented Jan 3, 2020

Copy link
Copy Markdown
Contributor Author

It seems there is some configuration issue on github that the build fails:

The command "bash .install-jdk-travis.sh" failed and exited with 2 during .

@jhy jhy added this to the 1.12.2 milestone Feb 2, 2020
@jhy jhy added the improvement An improvement / new feature idea label Feb 2, 2020
@jhy jhy merged commit 468c536 into jhy:master Feb 2, 2020
@jhy

jhy commented Feb 2, 2020

Copy link
Copy Markdown
Owner

Thanks! Merged with 894d3ec

I renamed it to be childrenSize for consistency with the other sizes of lists.

This was referenced Feb 9, 2020
This was referenced Feb 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement An improvement / new feature idea

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants