logicalsel Rexexp selects incorrect values since 2.2.3
In version 2.2.3, the logicalsel regular expression changed from:
logicalsel: '(is|where|matches|not)\\x28\\s?([^()]*|[^\\x28]*\\x28[^\\x29]*\\x29)\\s?(?:\\x29|$)',
to
logicalsel: '(is|where|matches|not)\\x28\\s?([^\\[]*\\[[^\\]]*\\]|[^\\(]*\\([^\\)]*\\)|[^()]*)\\s?(?:\\x29|$)',
When matching a selector of the form:
[EDIT: this example was incorrect in the original bug report but should now be correct — apologies for the mistake!]
div:not(.main) a:not([class=unstyled-link]) {
text-decoration: underline;
}
The old version would match not(.main) and not([class=unstyled-link]) separately but the new version matches the whole of not(.unstyled-links) a:not([class=unstyled-link)] as a single capture group. The [] in the second selector appears to be the problem — if I rewrite the second part of the selector as a:not(.unstyled-link) everything works as expected.
@paulbrimicombe it looks like the latest change I did to the Regular Expression solves for this selector and others too. Have you tried latest Github nwsapi commits ?
@paulbrimicombe it looks like the latest change I did to the Regular Expression solves for this selector and others too. Have you tried latest Github nwsapi commits ?
@dperini the code in master definitely looks correct (comparing the matches made by the old and new regular expressions) but without a pre-release published to NPM I wouldn't be able to tell for sure!
@paulbrimicombe @ALL See issue #89 and commit 01216f85b9989ce0f1d5b0ee5ce28bb88ea8aaa3 for a new regular expression that should fix remaining failure cases.
Hi @dperini , I've just checked v 2.2.5 and that looks good for us. It's harder to tell with the newer version because it's unreleased and I'd have to go in and hack node_modules to test it. Any chance of a pre-release published to npm?
@paulbrimicombe I need to release more fixes in 2.2.6 but it will be done soon.
@paulbrimicombe more fixes were committed to the "nwsapi" repository. Keep trying and report any issue you might find. Thank you for your feedback