Skip to content

Commit 2464877

Browse files
committed
better wording
1 parent 2697017 commit 2464877

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

readme.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ const FUNCTION = 13
3333

3434
#### Rule start
3535

36-
Marker `RULE_START` specifies the beginning of a rule, has a rule type.
36+
`[RULE_START, <type>]`
3737

38-
`[RULE_START, RULE_TYPE]`
38+
Marker `RULE_START` specifies the beginning of a rule, has a rule type.
3939

4040
All rule types from https://wiki.csswg.org/spec/cssom-constants
4141

@@ -61,19 +61,23 @@ All rule types from https://wiki.csswg.org/spec/cssom-constants
6161

6262
#### Rule end
6363

64+
`[RULE_END]`
65+
6466
Marker `RULE_END` specifies the end of a rule.
6567

6668
#### Named rule.
6769

70+
`[RULE_NAME, <name>]`
71+
6872
Marker `RULE_NAME` specifies a rule name.
6973

7074
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.
7175
We rely on the JavaScript module scope. Name should be unique within that module scope.
7276

73-
E.g. `[RULE_NAME, 'bar']`
74-
7577
#### Selector
7678

79+
`[SELECTOR, ...<selectors>]`
80+
7781
Marker `SELECTOR` specifies a selector or selector compound.
7882

7983
Selector e.g. `.foo` => `[SELECTOR, '.foo']`
@@ -84,39 +88,50 @@ Selector list e.g. `.foo, .bar` => `[SELECTOR, '.foo'], [SELECTOR, '.bar']`
8488

8589
#### Parent selector
8690

91+
`[PARENT_SELECTOR, ...<selectors>]`
92+
8793
Marker `PARENT_SELECTOR` specifies a selector, which is a reference to the parent selector.
8894
Useful for nesting.
8995

9096
E.g.: `&:hover` => `[PARENT_SELECTOR, ':hover']`
9197

9298
#### Combinators
9399

100+
`[ANY_COMBINATOR]`
101+
94102
All combinator constants denote any of 5 [CSS combinators](https://drafts.csswg.org/selectors/#combinators).
95103

96104
E.g.: `.foo .bar` => `[SELECTOR, '.foo', SPACE_COMBINATOR, '.bar']`
97105
or `.foo + .bar` => `[SELECTOR, '.foo', NEXT_SIBLING_COMBINATOR, '.bar']`
98106

99107
#### Property name
100108

109+
`[PROPERTY, <name>]`
110+
101111
Marker `PROPERTY` specifies a property name e.g.: `[PROPERTY, 'color']`.
102112

103113
#### Property value
104114

115+
`[VALUE, <value>]`
116+
105117
Marker `VALUE` specifies a property value e.g.: `[VALUE, 'red']`.
106118

107119
Multiple comma separated values e.g.: `red, green` => `[VALUE, 'red'], [VALUE, 'green']`.
108120

109121
#### Condition
110122

123+
`[CONDITION, <condition>]`
124+
111125
Marker `CONDITION` specifies a condition for conditional rules.
112126

113127
E.g. `@media all` => `[RULE_START, 4], [CONDITION, 'all']`
114128

115129
#### Function
116130

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>]`
118132

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.
120135

121136
Functional pseudo class e.g. `.foo:matches(:hover, :focus)` => `[SELECTOR, '.foo', [FUNCTION, ':matches', ':hover', ':focus']]`
122137

@@ -250,7 +265,7 @@ body, .foo {
250265
]
251266
```
252267

253-
### Nesting with a compound selector and regular selector
268+
### Nesting with a compound selector
254269

255270
```css
256271
.foo {
@@ -316,7 +331,6 @@ body, .foo {
316331

317332
### Functional value notation
318333

319-
`color: rgb(100, 200, 50)` => `[PROPERTY, 'color'], [FUNCTION, 'rgb', 100, 200, 50]`
320334
```css
321335
.foo {
322336
background: url(http://www.example.org/image);

0 commit comments

Comments
 (0)