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

feat: Use cheerio-select, to support positional selectors #1565

Merged
merged 2 commits into from Dec 20, 2020

Conversation

fb55
Copy link
Member

@fb55 fb55 commented Dec 15, 2020

Adds support for jQuery positional selectors (:eq, :first, :not(:last) etc.).

Fixes #1355
Fixes #129

Adds support for jQuery positional selectors (:eq, :first, :not(:last) etc.).

Fixes #1355
Fixes #129
Required to get support for `Set`.
@@ -4,7 +4,7 @@
},
"plugins": ["jsdoc"],
"extends": ["eslint:recommended", "prettier"],
"globals": {},
"globals": { "Set": true },
Copy link
Member Author

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 node 0.12. The minimum node version has been bumped to support this.

},
"dependencies": {
"css-select": "^3.1.2",
"cheerio-select": "github:cheeriojs/cheerio-select",
Copy link
Member Author

Choose a reason for hiding this comment

The 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.

// var $h2 = cheerio('<h2>fruits</h2>');
// console.log($elem.before('hi'));
// console.log($elem.before($h2));
it('should select first element cheerio(:first)', function () {
Copy link
Member Author

Choose a reason for hiding this comment

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

The test that has been skipped for forever is now finally live 😄

@fb55 fb55 merged commit aed540c into v1.0.0 Dec 20, 2020
@fb55 fb55 deleted the feat/cheerio-select branch December 20, 2020 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

:eq ,:gt, :lt cannot work $("tr:eq(2)") won't work but $("tr").eq(2) does
1 participant