Closed sambehrens closed 4 months ago
I'm having the same issue with :focus-within
and jsdom as well. The error stack trace does come back to nwsapi
The relevant lines of the stack trace are:
at emit (node_modules/nwsapi/src/nwsapi.js:570:17)
at compileSelector (node_modules/nwsapi/src/nwsapi.js:1310:11)
at compile (node_modules/nwsapi/src/nwsapi.js:758:16)
at match_collect (node_modules/nwsapi/src/nwsapi.js:1363:16)
at Object._matches [as match] (node_modules/nwsapi/src/nwsapi.js:1418:35)
I've run into problems with :focus-within
as well. Perhaps the issues are related to #47 for that selector.
I have also tested a different approach to solve this issue. I used the following regular expression, slightly modified:
useraction: '(hover|active|focus[^-]|focus-within)\\b',
which enforces checking for the :focus pseudo-class not being followed by a dash and it seems it works well.
Please test in your environment and report results here.
I'm still getting the SyntaxError: ':focus-within' is not a valid selector
error on nwsapi@2.2.4
Edit: Maybe this should be reopened since the fix for focus-within was reverted in 23f9e2386ea9eeddd59cf851d02002cf7c84babb
@dospunk you are correct ... reopening and working on it. Thank you for reporting the problem.
@sambehrens @samschurter @dospunk I hope I did resolve this and nwsapi will be ready for 2.2.10 release.
I ran into an issue where I was using jsdom which uses nwsapi for matching selectors and it was giving me the error
SyntaxError: ':focus-visible' is not a valid selector
. It doesn't seem like I should be getting this error because in the wiki for nwsapi, it says that the:focus-visible
is supported.Then I looked through the nwsapi repo and didn't see
focus-visible
where I thought it should exist. Here with the other user actions: https://github.com/dperini/nwsapi/blob/master/src/nwsapi.js#L83It would be great if this could be supported. Alternatively, the documentation could be updated explaining that it is actually not supported and why.
Reproduce:
Results in
Uncaught DOMException: ':focus-visible' is not a valid selector
.On another note, it looks like
focus-within
throws the same error, even though it looks like it is available in the source code. Not sure why that would be though.