-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat: Use cheerio-select
, to support positional selectors
#1565
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,10 +24,10 @@ | |
"lib" | ||
], | ||
"engines": { | ||
"node": ">= 0.6" | ||
"node": ">= 0.12" | ||
}, | ||
"dependencies": { | ||
"css-select": "^3.1.2", | ||
"cheerio-select": "github:cheeriojs/cheerio-select", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have a Github reference here, until cheeriojs/cheerio-select#2 is resolved. |
||
"dom-serializer": "~1.2.0", | ||
"entities": "~2.1.0", | ||
"htmlparser2": "^6.0.0", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,11 +158,13 @@ describe('cheerio', function () { | |
expect($fruits[0].attribs.id).to.equal('fruits'); | ||
}); | ||
|
||
it('should select first element cheerio(:first)'); | ||
// var $elem = cheerio(':first', fruits); | ||
// var $h2 = cheerio('<h2>fruits</h2>'); | ||
// console.log($elem.before('hi')); | ||
// console.log($elem.before($h2)); | ||
it('should select first element cheerio(:first)', function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test that has been skipped for forever is now finally live 😄 |
||
var $elem = cheerio('li:first', fruits); | ||
expect($elem.attr('class')).to.equal('apple'); | ||
|
||
var $filtered = cheerio('li', fruits).filter(':even'); | ||
expect($filtered).to.have.length(2); | ||
}); | ||
|
||
it('should be able to select immediate children: cheerio("#fruits > .pear")', function () { | ||
var $food = cheerio(food); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set
has been supported since node0.12
. The minimum node version has been bumped to support this.