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

Document, test, and extend static $.text method #855

Closed
wants to merge 2 commits into from

Conversation

jugglinmike
Copy link
Member

As noted in the commit messages, this method was previously undocumented and untested. Add tests, and implement a change that, while technically backwards-incompatible, promotes parity between this method and the static methods $.html and $.xml.

@coveralls
Copy link

coveralls commented Apr 27, 2016

Coverage Status

Coverage decreased (-0.1%) to 98.71% when pulling f9d0e1a on jugglinmike:static-text into 7b59afb on cheeriojs:master.

Update `$.root` to return the rendered text content of the current root
element when no argument is specified. This increases API parity with
the existing static methods `$.html` and``$.xml`.

This change technically breaks backwards compatability, but the previous
behavior was undocumented and untested.
@coveralls
Copy link

coveralls commented Apr 28, 2016

Coverage Status

Coverage increased (+0.001%) to 98.825% when pulling f050807 on jugglinmike:static-text into 7b59afb on cheeriojs:master.


```js
$ = cheerio.load('<div>This is <em>content</em>.</div>')
cheerio.text($('div'))
Copy link
Member

Choose a reason for hiding this comment

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

There could perhaps be a test case for this as well. LGTM otherwise!

@fb55
Copy link
Member

fb55 commented Jun 12, 2016

Merged as 54359c9. Not sure why Github isn't showing it.

@fb55 fb55 closed this Jun 12, 2016
romellem pushed a commit to romellem/cheerio that referenced this pull request Jun 13, 2016
* Document and test static `text` method

* Extend `$.text()` to operate on current root

Update `$.root` to return the rendered text content of the current root
element when no argument is specified. This increases API parity with
the existing static methods `$.html` and``$.xml`.

This change technically breaks backwards compatability, but the previous
behavior was undocumented and untested.
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.

3 participants