diff options
author | 2021-04-01 10:25:28 -0600 | |
---|---|---|
committer | 2021-04-01 10:25:28 -0600 | |
commit | c26c244ca2634d462616d6cf71072fbe26becba2 (patch) | |
tree | 1bd5e83eff9ca88200aacb272c84439f192015ec /src/compiler/optimize/postcss-scoped-styles | |
parent | f6a7ac67befff863e34133673efb78ea7ac0fe48 (diff) | |
download | astro-c26c244ca2634d462616d6cf71072fbe26becba2.tar.gz astro-c26c244ca2634d462616d6cf71072fbe26becba2.tar.zst astro-c26c244ca2634d462616d6cf71072fbe26becba2.zip |
Annoying Lint PR #2 (#47)
Diffstat (limited to 'src/compiler/optimize/postcss-scoped-styles')
-rw-r--r-- | src/compiler/optimize/postcss-scoped-styles/index.ts | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/compiler/optimize/postcss-scoped-styles/index.ts b/src/compiler/optimize/postcss-scoped-styles/index.ts index a4afd99aa..0d1253350 100644 --- a/src/compiler/optimize/postcss-scoped-styles/index.ts +++ b/src/compiler/optimize/postcss-scoped-styles/index.ts @@ -24,15 +24,17 @@ export function scopeSelectors(selector: string, className: string) { let ss = selector; // final output // Pass 1: parse selector string; extract top-level selectors - let start = 0; - let lastValue = ''; - for (let n = 0; n < ss.length; n++) { - const isEnd = n === selector.length - 1; - if (isEnd || CSS_SEPARATORS.has(selector[n])) { - lastValue = selector.substring(start, isEnd ? undefined : n); - if (!lastValue) continue; - selectors.push({ start, end: isEnd ? n + 1 : n, value: lastValue }); - start = n + 1; + { + let start = 0; + let lastValue = ''; + for (let n = 0; n < ss.length; n++) { + const isEnd = n === selector.length - 1; + if (isEnd || CSS_SEPARATORS.has(selector[n])) { + lastValue = selector.substring(start, isEnd ? undefined : n); + if (!lastValue) continue; + selectors.push({ start, end: isEnd ? n + 1 : n, value: lastValue }); + start = n + 1; + } } } |