You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: active-rfcs/0023-scoped-styles-changes.md
+11-3Lines changed: 11 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -13,12 +13,18 @@ Provide more consistent custom CSS extensions in Single File Component scoped st
13
13
<stylescoped>
14
14
/* deep selectors */
15
15
::v-deep(.foo) {}
16
+
/* shorthand */
17
+
:deep(.foo) {}
16
18
17
19
/* targeting slot content */
18
20
::v-slotted(.foo) {}
21
+
/* shorthand */
22
+
:slotted(.foo) {}
19
23
20
24
/* one-off global rule */
21
25
::v-global(.foo) {}
26
+
/* shorthand */
27
+
:global(.foo) {}
22
28
</style>
23
29
```
24
30
@@ -38,17 +44,19 @@ To avoid the confusion of the dropped `/deep/` combinator, we introduced yet ano
38
44
39
45
The previous versions of the deep combinator are still supported for compatibility reasons in the current [Vue 2 SFC compiler](https://github.com/vuejs/component-compiler-utils), which again, can be confusing to users. In v3, we are deprecating the support for `>>>` and `/deep/`.
40
46
41
-
As we were working on the new SFC compiler for v3, we noticed that CSS pseudo elements are in fact semantically NOT [combinators](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors/Combinators). It is more consistent with idiomatic CSS for pseudo elements to accept arguments instead, so we are also making `::v-deep()` work that way. The current usage of `::v-deep` as a combinator is still supported, however it is considered deprecated and will raise a warning.
47
+
As we were working on the new SFC compiler for v3, we noticed that CSS pseudo elements are in fact semantically NOT [combinators](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors/Combinators). It is more consistent with idiomatic CSS for pseudo elements to accept arguments instead, so we are also making `::v-deep()` work that way. If you don't care about the explicit `v-` prefix, you can also use the shorter `:deep()` variant, which works exactly the same.
48
+
49
+
The current usage of `::v-deep` as a combinator is still supported, however it is considered deprecated and will raise a warning.
42
50
43
51
## Targeting / Avoiding Slot Content
44
52
45
53
Currently, slot content passed in from the parent are affected by both the parent's scoped styles AND the child's scoped styles. There is no way to author rules that explicitly target slot content only, or ones that do not affect slot content.
46
54
47
-
In v3, we intend to make child scoped styles NOT affecting slot content by default. To explicitly target slot content, the `::v-slotted()` pseudo element can be used.
55
+
In v3, we intend to make child scoped styles NOT affecting slot content by default. To explicitly target slot content, the `::v-slotted()`(shorthand: `:slotted()`) pseudo element can be used.
48
56
49
57
## One-Off Global Rules
50
58
51
-
Currently to add a global CSS rule we need to use a separate unscoped `<style>` block. We are introducing a new `::v-global()` pseudo element for one-off global rules.
59
+
Currently to add a global CSS rule we need to use a separate unscoped `<style>` block. We are introducing a new `::v-global()`(shorthand: `:global()`) pseudo element for one-off global rules.
0 commit comments