-
Notifications
You must be signed in to change notification settings - Fork 42
Updated pseudo-nop regex to generically capture all vendor extensions as no-op selectors.
#151
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
base: master
Are you sure you want to change the base?
Conversation
- Fixes dperini#150 - Unclear if this is the best approach, as it won't handle support for other `-moz-*` pseudo-classes. - Also unsure whether this would be better placed in the `inputstate` regex rather than `pseudo_nop`, but couldn't get it working nicely there with the capture groups and existing parsing for the `read-only` pseudo-class - open to suggestions if this would be more appropriate!
|
@alexjamesmacpherson If we agree on the fact that we need to capture any vendors extensions and turn them in no-op rergarding selectors, then the following Regular Expression seems to be the one adequate to the generic aspect of such resolver: see https://regex101.com/r/1kvbU1/1 if not, we have to match exactly what we need and bind a specific resolver to each of them. Would be great if you and your team could do some test regarding the above changes. I am open to publish this change and the other unpublished commits as quick as possible in a new npm release. |
|
@dperini no problem at all - will have the team test this regex out today and get back to you before the end of the day! WRT. vendor extensions being treated as no-op, this seems adequate to me for the time being (certainly vs the existing behaviour of failing to parse at all!) - and I suppose if there is need for them to be handled more specifically in the future, this can be addressed as+when identified. Thanks for your quick response on this, really appreciate your effort as always in maintaining this library! ❤️ Edit: initial testing looks good! Will have my team review more thoroughly, as they were seeing other selectors which failed to parse too. Before: After: |
-moz-read-only to pseudo-nop regex.pseudo-nop regex to generically capture all vendor extensions as no-op selectors.
|
@dperini |
|
I don't think a no-op is appropriate here. When I do So, I think nwsapi should follow the specifications, and not accept such invalid selectors. |
|
That sounds like a bug in whatever framework you're using that implements |
|
@domenic |
|
@domenic @mikemazara @alexjamesmacpherson Proof is that in Firefox and Brave browsers no exceptions are thrown for querying special vendors extensions: While in Chrome and Opera browsers I confirm the same query does throw an exception as @domenic described. does not throw in either Chrome or Firefox. The documented Chromium/Blink bug is here: https://issues.chromium.org/issues/41179548 What are the options we have to flatten the issues we are seeing ? |
|
The specced solution is to support none of those, as they are all nonstandard. The eventual goal of all browsers is to remove nonstandard features like that. I think it's best if nwsapi conforms to the spec and throws exceptions, like all browsers will in the future. |
|
@domenic |
|
From a little more digging on the failing test I have, I wonder if the vendor exceptions are actually a red herring in this instance 🤔 I see that JSDOM, when trying to match a selector, initialises and configures NWSAPI with However, despite this configuration, NWSAPI is still throwing, with the @domenic I see a similar issue which you fixed on JSDOM where someone mentioned they needed to add a workaround for JSDOM to prevent the |
|
If this is an issue with how jsdom is using nwsapi, then an issue on the jsdom repository, following the issue template---i.e., so there are no third party libraries at all involved---would be welcome. |
|
@domenic I don’t believe this is an issue with how JSDOM is using NWSAPI, as it’s correctly configuring NWSAPI to not throw when trying to match selectors, as demonstrated above. But NWSAPI is still throwing, so I believe this to be an issue with NWSAPI incorrectly throwing when configured not to. |
|
Well, I still think a small repro that uses jsdom only might be useful in debugging the interaction :) |



:-moz-read-only#150-moz-read-only) failing to parse and throwing an error, thereby failing test execution.