When I try to use :first pseudo-selector in $(...).find('.descr + span i:first').text() cheerio throw error:
/home/user/project/node_modules/cheerio/node_modules/CSSselect/lib/pseudos.js:333
throw new SyntaxError("unmatched pseudo-class :" + name);
^
SyntaxError: unmatched pseudo-class :first
at module.exports.compile [as pseudo] (/home/user/project/node_modules/cheerio/node_modules/CSSselect/lib/pseudos.js:333:10)
at /home/user/project/node_modules/cheerio/node_modules/CSSselect/lib/compile.js:35:26
at Array.reduce (native)
at compileRules (/home/user/project/node_modules/cheerio/node_modules/CSSselect/lib/compile.js:33:24)
at Array.map (native)
at compileUnsafe (/home/user/project/node_modules/cheerio/node_modules/CSSselect/lib/compile.js:27:4)
at select (/home/user/project/node_modules/cheerio/node_modules/CSSselect/index.js:17:43)
at CSSselect (/home/user/project/node_modules/cheerio/node_modules/CSSselect/index.js:40:9)
at exports.find (/home/user/project/node_modules/cheerio/lib/api/traversing.js:13:21)
at IncomingMessage.<anonymous> (/home/user/project/app.js:105:61)
But when I use .first() selector ($(...).find('.descr + span i').first().text()) cheerio works well.
Version of cheerio is 0.17.0.
If you search our issues for the word "first", you'll find gh-408 at the top of the list. The discussion there in includes an explanation for why this feature is low priority. Use .first() instead
Most helpful comment
If you search our issues for the word "first", you'll find gh-408 at the top of the list. The discussion there in includes an explanation for why this feature is low priority. Use
.first()instead