postcss-pseudo-classes icon indicating copy to clipboard operation
postcss-pseudo-classes copied to clipboard

ignore :is pseudoclass as parentheses can contain unhandled spaces and further pseudoclasses

Open eoghanmurray opened this issue 1 year ago • 1 comments

  • when :is was escaped, the space within the brackets was not escaped and we got a unusable class of a\:is\(.\:hover, .current), which also has an unescaped closing bracket
  • IMO without allCombinations it's reasonable to expect the :is to be maintained as-is, so that explicit .\:hover classes can be programmatically added without having to add classes for each of the :is rules in the stylesheet, which is likely to be non-trivial given how this pseudoclass is used in the wild.

I've solved in this PR by blacklisting :is, but possibly there is a better solution out there which IMO would need to replicate some of the effect of allCombinations even in the absence of that option.

Example ideal solution, not implemented in this PR:

    a:is(:hover, .current, .\:hover),
    a.\:is\(\:hover\,\ \.current\) {
      color: firebrick;
    }

Above demonstrates recursive addition of new class within the 'sub selector' of the :is parenthesis, as well as proper escaping of a full :is statement (which I can't imagine anyone ever using)

eoghanmurray avatar Jul 17 '24 10:07 eoghanmurray

This came about due to a test case from the following PR in another repository: https://github.com/rrweb-io/rrweb/pull/1535

eoghanmurray avatar Jul 17 '24 10:07 eoghanmurray