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: readme.md
+22-8Lines changed: 22 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -33,9 +33,9 @@ const FUNCTION = 13
33
33
34
34
#### Rule start
35
35
36
-
Marker `RULE_START` specifies the beginning of a rule, has a rule type.
36
+
`[RULE_START, <type>]`
37
37
38
-
`[RULE_START, RULE_TYPE]`
38
+
Marker `RULE_START` specifies the beginning of a rule, has a rule type.
39
39
40
40
All rule types from https://wiki.csswg.org/spec/cssom-constants
41
41
@@ -61,19 +61,23 @@ All rule types from https://wiki.csswg.org/spec/cssom-constants
61
61
62
62
#### Rule end
63
63
64
+
`[RULE_END]`
65
+
64
66
Marker `RULE_END` specifies the end of a rule.
65
67
66
68
#### Named rule.
67
69
70
+
`[RULE_NAME, <name>]`
71
+
68
72
Marker `RULE_NAME` specifies a rule name.
69
73
70
74
Instead of using a selector, a rule can be identified by a name. This is a preferred way instead of using hardcoded selectors. Consumer library will generate a selector for the rule and user can access it by name.
71
75
We rely on the JavaScript module scope. Name should be unique within that module scope.
72
76
73
-
E.g. `[RULE_NAME, 'bar']`
74
-
75
77
#### Selector
76
78
79
+
`[SELECTOR, ...<selectors>]`
80
+
77
81
Marker `SELECTOR` specifies a selector or selector compound.
78
82
79
83
Selector e.g. `.foo` => `[SELECTOR, '.foo']`
@@ -84,39 +88,50 @@ Selector list e.g. `.foo, .bar` => `[SELECTOR, '.foo'], [SELECTOR, '.bar']`
84
88
85
89
#### Parent selector
86
90
91
+
`[PARENT_SELECTOR, ...<selectors>]`
92
+
87
93
Marker `PARENT_SELECTOR` specifies a selector, which is a reference to the parent selector.
88
94
Useful for nesting.
89
95
90
96
E.g.: `&:hover` => `[PARENT_SELECTOR, ':hover']`
91
97
92
98
#### Combinators
93
99
100
+
`[ANY_COMBINATOR]`
101
+
94
102
All combinator constants denote any of 5 [CSS combinators](https://drafts.csswg.org/selectors/#combinators).
Marker `CONDITION` specifies a condition for conditional rules.
112
126
113
127
E.g. `@media all` => `[RULE_START, 4], [CONDITION, 'all']`
114
128
115
129
#### Function
116
130
117
-
Marker `FUNCTION` specifies [functional pseudo class](https://drafts.csswg.org/selectors/#functional-pseudo-class) as well as [functional notation](https://drafts.csswg.org/css-values-4/#functional-notation).
131
+
`[FUNCTION, <name>, ...<arguments>]`
118
132
119
-
After the FUNCTION marker follows the function name and each argument as a separate entry: `[FUNCTION, {NAME}, {ARG0}, {ARG1}, ...]`
133
+
Marker `FUNCTION` specifies [functional pseudo class](https://drafts.csswg.org/selectors/#functional-pseudo-class) as well as [functional notation](https://drafts.csswg.org/css-values-4/#functional-notation).
134
+
After the FUNCTION marker follows the function name and each argument as a separate entry.
120
135
121
136
Functional pseudo class e.g. `.foo:matches(:hover, :focus)` => `[SELECTOR, '.foo', [FUNCTION, ':matches', ':hover', ':focus']]`
122
137
@@ -250,7 +265,7 @@ body, .foo {
250
265
]
251
266
```
252
267
253
-
### Nesting with a compound selector and regular selector
0 commit comments