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

"Did not expect successive traversals" when parsing 2 sibling html comments #2500

Closed
bago opened this issue Apr 28, 2022 · 2 comments · Fixed by #2504
Closed

"Did not expect successive traversals" when parsing 2 sibling html comments #2500

bago opened this issue Apr 28, 2022 · 2 comments · Fixed by #2504

Comments

@bago
Copy link

bago commented Apr 28, 2022

Since 1.0.0-rc.6 cheerio give me fatal exception while dealing with fragments having comments:

    var $ = require('cheerio').load("whatever");
    const a = $('<!-- comment --><!-- anothercomment -->');
Error: Did not expect successive traversals.
    at ensureNotTraversal (C:\Lab\Void\projects\mosaico\node_modules\css-what\lib\commonjs\parse.js:137:19)
    at addTraversal (C:\Lab\Void\projects\mosaico\node_modules\css-what\lib\commonjs\parse.js:146:9)
    at parseSelector (C:\Lab\Void\projects\mosaico\node_modules\css-what\lib\commonjs\parse.js:204:17)
    at parse (C:\Lab\Void\projects\mosaico\node_modules\css-what\lib\commonjs\parse.js:83:20)
    at Object.select (C:\Lab\Void\projects\mosaico\node_modules\cheerio-select\lib\index.js:191:65)
    at LoadedCheerio.find (C:\Lab\Void\projects\mosaico\node_modules\cheerio\lib\api\traversing.js:55:30)
    at LoadedCheerio.Cheerio (C:\Lab\Void\projects\mosaico\node_modules\cheerio\lib\cheerio.js:82:30)
    at new LoadedCheerio (C:\Lab\Void\projects\mosaico\node_modules\cheerio\lib\load.js:32:46)
    at initialize (C:\Lab\Void\projects\mosaico\node_modules\cheerio\lib\load.js:38:16)
    at Object.<anonymous> (C:\Lab\Void\projects\mosaico\spec\converter-spec.js:48:15)

0.4.0 and 1.0.0-rc.1 to 1.0.0-rc.5 works fine.

I guess the problem is with the updated css-what dependency, but I don't understand why an html including only 2 comments should rise an exception in a css selector library.

@bago
Copy link
Author

bago commented Apr 28, 2022

I can also confirm that 1.0.0-rc.5 with forced css-what 6.1.0 version works fine, so the issue is probably in cheerio (or another intermediate dependency, like cheerio-select) and not css-what.

bago added a commit to voidlabs/mosaico that referenced this issue Apr 28, 2022
fb55 added a commit that referenced this issue Apr 30, 2022
@fb55
Copy link
Member

fb55 commented Apr 30, 2022

Fixed in #2504

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants