Fix regression with dePseudify() if there are multiple pseudos that are to be ignored #346
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Between 0.15.0 and 0.16.0,
dePseudify()seemed to start mishandling selectors that have multiple pseudos, which isn't a case well-represented in the test suite but does occur in the wild (e.g. in Bootstrap 4).I'm including here a failing test and a possible fix.
On 0.15.0:
On master / 0.16.0:
I bisected this to 0170fe1 (#345), which I think is the culprit.
That
pseudosRegex = new RegExp('([^\\\\])(' + ignoredPseudos.join('|') + ')', 'g')produces weird results if you have multiple pseudos hanging off a selector, e.g.:I think if we just give the pseudo group a quantifier instead of trying to use the
gflag from the old regex, we would get what we want (i.e. replace on any non-slash character followed by one or more pseudos):It should also still work for the original "escaped" case the original change wanted to accomplished:
It also seems to work for at least what is present in today's test suite.