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

fix examples: $.html, $.text #2286

Closed
wants to merge 1 commit into from
Closed

fix examples: $.html, $.text #2286

wants to merge 1 commit into from

Conversation

milahu
Copy link

@milahu milahu commented Jan 2, 2022

before

> cheerio.html($('.pear'));
Uncaught TypeError: cheerio.html is not a function

> cheerio.text($('body'));
Uncaught TypeError: cheerio.text is not a function

after

> $.html($('.pear'));
'<li class="pear">Pear</li>'

> $.text($('body'));
'This is content.'

@Hashbrown777
Copy link

This 'fix' is incorrect, the documentation is accurate and the code itself is incorrect (see #2402).
The examples are specifically talking about the static functions.

You've changed the static call cheerio.text($('body')); to a call to the member function (of the document) $.text($('body'));.
If you're willing to use member functions, you can just do $('body').text().

@milahu
Copy link
Author

milahu commented Mar 23, 2022

closing for #2402

@milahu milahu closed this Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants