forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs-infra] Fix RTL dark mode (mui#41803)
- Loading branch information
1 parent
c328fe4
commit e2ba426
Showing
3 changed files
with
21 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* eslint-disable default-case */ | ||
import { Element, RULESET } from 'stylis'; | ||
|
||
// A workaround to https://github.com/emotion-js/emotion/issues/2836 | ||
// to be able to use `:where` selector for styling. | ||
export default function globalSelector(element: Element) { | ||
switch (element.type) { | ||
case RULESET: | ||
element.props = (element.props as string[]).map((value: any) => { | ||
if (value.match(/(:where|:is)\(/)) { | ||
value = value.replace(/\.[^:]+(:where|:is)/, '$1'); | ||
return value; | ||
} | ||
return value; | ||
}); | ||
} | ||
} |