-
Notifications
You must be signed in to change notification settings - Fork 43
Description
My team has observed NWSAPI yielding a syntax error when parsing the :-moz-read-only pseudo-class selector. From debug inspection, the full selector_string to be parsed is :scope input:-moz-read-only, with the :-moz-read-only then parsed from this string.
This error is occurring during a React Testing Library test for a React component which renders the MaterialUI Autocomplete component, which it seems implements this selector somewhere in its styling.
To be clear, we are not attempting to select an element using this selector, but the failure to parse the selector at all prevents us from using other selectors.
From testing, this issue did not exist in NWSAPI v2.2.7 and below, and began to occur from v2.2.8 onwards.
It is difficult to workaround this issue in our test code, as the failure to parse the unknown selector limits the selection methods we're able to use in our tests. We are also unable to remove the selector from the offending component as it is implemented by a 3rd party.
From limited testing, NWSAPI can be trivially modified to include -moz-read-only in the pseudo_nop regex def (see #151), which facilitates successfully parsing and ignoring the selector - but I wonder whether it would be safer in general to simply ignore unknown selectors rather than throwing, as I imagine there may be other -moz-* selectors which exhibit the same issue?