dperini / nwsapi

Fast CSS Selectors API Engine
MIT License
103 stars 35 forks source link

v2.2.8 introduces SyntaxError: ':focus-visible' is not a valid selector #110

Closed cbix closed 3 months ago

cbix commented 4 months ago

I noticed a similar regression as #108, one test using react-testing-library (→ jsdom) started failing with

SyntaxError: ':focus-visible' is not a valid selector

      at emit (node_modules/nwsapi/src/nwsapi.js:557:17)
      at compileSelector (node_modules/nwsapi/src/nwsapi.js:1288:11)
      at compile (node_modules/nwsapi/src/nwsapi.js:745:16)
      at collect (node_modules/nwsapi/src/nwsapi.js:1546:22)
      at _querySelectorAll (node_modules/nwsapi/src/nwsapi.js:1506:36)
      at Object._querySelector [as first] (node_modules/nwsapi/src/nwsapi.js:1412:14)
      at Array.Resolver (eval at compile (node_modules/nwsapi/src/nwsapi.js:760:17), <anonymous>:3:91)
      at match_assert (node_modules/nwsapi/src/nwsapi.js:1339:13)
      at Object._matches [as match] (node_modules/nwsapi/src/nwsapi.js:1357:16)
          at Array.forEach (<anonymous>)
          at Array.forEach (<anonymous>)
          at Array.forEach (<anonymous>)
      at closestPointerEventsDeclaration (node_modules/@testing-library/user-event/dist/cjs/utils/pointer/cssPointerEvents.js:16:38)
      at checkPointerEvents (node_modules/@testing-library/user-event/dist/cjs/utils/pointer/cssPointerEvents.js:36:25)
      at Object.assertPointerEvents (node_modules/@testing-library/user-event/dist/cjs/utils/pointer/cssPointerEvents.js:45:25)
      at Object.enter (node_modules/@testing-library/user-event/dist/cjs/system/pointer/pointer.js:57:34)
      at PointerHost.move (node_modules/@testing-library/user-event/dist/cjs/system/pointer/index.js:50:79)
      at pointerAction (node_modules/@testing-library/user-event/dist/cjs/pointer/index.js:64:39)
      at Object.pointer (node_modules/@testing-library/user-event/dist/cjs/pointer/index.js:32:15)
      at Object.asyncWrapper (node_modules/@testing-library/react/dist/pure.js:88:22)

If needed I can try to open a repo for reproducing this.

TonyxSun commented 4 months ago

Bump, also related to #54

adrien1251 commented 4 months ago

Hello, any news for this bug ? i upgrade nwsapi to 2.2.8 and also in 2.2.9 and i have this issue :

SyntaxError: '>input:focus-visible' is not a valid selector
 ❯ emit node_modules/nwsapi/src/nwsapi.js:557:17
 ❯ _querySelectorAll node_modules/nwsapi/src/nwsapi.js:1501:9
 ❯ Object._querySelector [as first] node_modules/nwsapi/src/nwsapi.js:1412:14
 ❯ HTMLLabelElementImpl.querySelector node_modules/jsdom/lib/jsdom/living/nodes/ParentNode-impl.js:69:44
 ❯ HTMLLabelElement.querySelector node_modules/jsdom/lib/jsdom/living/generated/Element.js:1094:58
 ❯ Array.Resolver node_modules/nwsapi/src/nwsapi.js:760:17
 ❯ match_assert node_modules/nwsapi/src/nwsapi.js:1339:13
 ❯ Object._matches [as match] node_modules/nwsapi/src/nwsapi.js:1357:16
 ❯ exports.matchesDontThrow node_modules/jsdom/lib/jsdom/living/helpers/selectors.js:29:36
 ❯ matches node_modules/jsdom/lib/jsdom/living/helpers/style-rules.js:172:10

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { code: 12, INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, INVALID_CHARACTER_ERR: 5, NO_DATA_ALLOWED_ERR: 6, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INUSE_ATTRIBUTE_ERR: 10, INVALID_STATE_ERR: 11, SYNTAX_ERR: 12, INVALID_MODIFICATION_ERR: 13, NAMESPACE_ERR: 14, INVALID_ACCESS_ERR: 15, VALIDATION_ERR: 16, TYPE_MISMATCH_ERR: 17, SECURITY_ERR: 18, NETWORK_ERR: 19, ABORT_ERR: 20, URL_MISMATCH_ERR: 21, QUOTA_EXCEEDED_ERR: 22, TIMEOUT_ERR: 23, INVALID_NODE_TYPE_ERR: 24, DATA_CLONE_ERR: 25 }

When i downgrade to 2.2.7, everythings works. Is there a fix planned?

Have a nice day.

dperini commented 3 months ago

@cbix @TonyxSun the fix has been applied, problem should be resolved in current master. Maybe you can confirm this solves your problem.

cbix commented 3 months ago

@dperini I can confirm it's fixed on latest master, thanks! Would be awesome to see a release with that fix :)

dperini commented 3 months ago

@cbix I am almost there, 2.2.10 is ready to go. You can help spot last minute mistakes please checkout master and test it. If you can !

cbix commented 3 months ago

@dperini nice, yea I checked out master and our tests all passed again without errors. Anyway like I said nwsapi for us was just the indirect dep through jsdom.