Skip to content

Commit

Permalink
fix: class selector start index tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
kripod committed Jul 21, 2020
1 parent 16acfbc commit f9f666e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/otion/src/createInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,14 @@ export function createInstance(): OtionInstance {
let firstParentRuleHead =
key[0] === ":" || key[0] === "@" ? key : minifyCondition(key);
let parentRuleTail = "";
let scopeClassSelectorStartIndex = classSelectorStartIndex;

if (!classSelectorStartIndex) {
if (scopeClassSelectorStartIndex == null) {
if (
firstParentRuleHead[0] === ":" ||
firstParentRuleHead[0] === "&"
) {
// eslint-disable-next-line no-param-reassign
classSelectorStartIndex = cssTextHead.length;
scopeClassSelectorStartIndex = cssTextHead.length;
parentRuleHeads = firstParentRuleHead.split(",").map(
(singleSelector) =>
minifyCondition(singleSelector).replace("&", ""), // lgtm [js/incomplete-sanitization]
Expand All @@ -264,7 +264,7 @@ export function createInstance(): OtionInstance {
value as ScopedCSSRules,
cssTextHead + parentRuleHead,
parentRuleTail + cssTextTail,
classSelectorStartIndex,
scopeClassSelectorStartIndex,
);
},
);
Expand Down

0 comments on commit f9f666e

Please sign in to comment.