Skip to content

Commit

Permalink
fix: improve custom selector list splitting
Browse files Browse the repository at this point in the history
related to #45
  • Loading branch information
kripod committed Jul 28, 2020
1 parent 4d372ab commit 37b02a9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/otion/src/createInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,15 @@ export function createInstance(): OtionInstance {
firstParentRuleHead[0] === "&"
) {
scopeClassSelectorStartIndex = cssTextHead.length;
parentRuleHeads = firstParentRuleHead.split(",").map(
(singleSelector) =>
minifyCondition(singleSelector).replace("&", ""), // lgtm [js/incomplete-sanitization]
);
parentRuleHeads = firstParentRuleHead
.split(
// Inspired by: https://stackoverflow.com/a/9030062
/,(?![^[]*?[^\\]["']\s*?\])/,
)
.map(
(singleSelector) =>
minifyCondition(singleSelector).replace("&", ""), // lgtm [js/incomplete-sanitization]
);
} else if (firstParentRuleHead === "selectors") {
firstParentRuleHead = "";
} else if (firstParentRuleHead[0] !== "@") {
Expand Down

0 comments on commit 37b02a9

Please sign in to comment.