We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
A function closest() is now working only on tags. It used to work on text nodes too on 1.0.0-rc.10.
closest()
1.0.0-rc.10
Breaking commit: #2057
parent(), parents() and parentsUntil() functions still work for text nodes though. I expect closest() to behave the same way.
parent()
parents()
parentsUntil()
Example:
const cheerio = require('cheerio'); const $ = cheerio.load('<span>abc</span>'); const textNode = $('span').contents().first(); console.log(textNode.closest('span').length);
Expected output is 1 (i.e. closest span has been found), current version returns 0.
I'll create a pull request soon.
The text was updated successfully, but these errors were encountered:
closest
fix(traversing): Make closest be able to start from text nodes (#2811)
97f3739
Fixes #2810
Successfully merging a pull request may close this issue.
A function
closest()
is now working only on tags. It used to work on text nodes too on1.0.0-rc.10
.Breaking commit: #2057
parent()
,parents()
andparentsUntil()
functions still work for text nodes though. I expectclosest()
to behave the same way.Example:
Expected output is 1 (i.e. closest span has been found), current version returns 0.
I'll create a pull request soon.
The text was updated successfully, but these errors were encountered: