@torpor/view 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/compile.cjs +8 -10
- package/dist/compile.cjs.map +1 -1
- package/dist/compile.js +8 -10
- package/dist/compile.js.map +1 -1
- package/package.json +1 -1
- package/src/compile/parse/scopeStyles.ts +13 -12
package/package.json
CHANGED
|
@@ -20,24 +20,25 @@ export default function scopeStyles(status: ParseStatus): void {
|
|
|
20
20
|
|
|
21
21
|
function scopeStylesOnNode(node: TemplateNode, selectors: string[]) {
|
|
22
22
|
if (isElementNode(node) || isComponentNode(node)) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
node.scopeStyles =
|
|
24
|
+
selectors.includes(node.tagName) ||
|
|
25
|
+
node.attributes.find((a) => {
|
|
26
26
|
if (a.name === "class" && a.reactive) {
|
|
27
27
|
// Any reactivity in a class attribute makes it scoped,
|
|
28
28
|
// because we can't tell what's going on in there
|
|
29
|
-
|
|
29
|
+
return true;
|
|
30
30
|
} else if (a.name === "id" && a.value) {
|
|
31
|
-
|
|
31
|
+
if (selectors.includes(`#${trimQuotes(a.value)}`)) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
32
34
|
} else if (a.name === "class" && a.value) {
|
|
33
|
-
|
|
35
|
+
for (let classname of trimQuotes(a.value).split(/\s+/)) {
|
|
36
|
+
if (selectors.includes(`.${classname}`)) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
34
40
|
}
|
|
35
|
-
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
node.scopeStyles = scopeStyles;
|
|
41
|
+
}) !== undefined;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
if (isParentNode(node)) {
|