fix: remove regex negative lookbehind for safari compatibility (#72)

* fix: remove regex negative lookbehind for safari compatibility

* fix: remove regex negative lookbehind for safari compatibility

Co-authored-by: Mark Lawlor <mwlawlor@gmail.com>
This commit is contained in:
InfiniteXyy
2022-06-03 05:53:40 +08:00
committed by Mark Lawlor
parent dc9cef6bb0
commit 25476cb57a

View File

@@ -76,9 +76,9 @@ function getStyles(
// We cannot just test for `:active` as it will match hover\\:active-foobar:hover
// Due to how classNames are escaped, we can just check for :active and ensure
// it doesn't have an escape character before it.
if (/(?<!\\):active/.test(cssRule.selectorText)) states.push(active);
if (/(?<!\\):focus/.test(cssRule.selectorText)) states.push(focus);
if (/(?<!\\):hover/.test(cssRule.selectorText)) states.push(hover);
if (/[^\\]:active/.test(cssRule.selectorText)) states.push(active);
if (/[^\\]:focus/.test(cssRule.selectorText)) states.push(focus);
if (/[^\\]:hover/.test(cssRule.selectorText)) states.push(hover);
return states.every(Boolean);
}