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
**Current Issue:** The parser completely fails to parse selectors in nested rules when they start with combinators (`>`, `~`, `+`, `||`). It creates an empty selector list with the raw text stored but no child nodes.
**Impact:****CRITICAL** - CSS Nesting is a standard feature now supported in all modern browsers (2023+). The formatter outputs completely invalid CSS with missing selectors:
84
+
85
+
```css
86
+
/* Expected output */
87
+
.parent {
88
+
> a {
89
+
color: red;
90
+
}
91
+
}
92
+
93
+
/* Actual output */
94
+
.parent {
95
+
{
96
+
color: red;
97
+
}
98
+
}
99
+
```
100
+
101
+
**Workaround:** Currently impossible. While the selector text exists in the `.text` property, the formatter is designed to work with structured AST nodes. Falling back to raw text would require a complete rewrite of the selector formatting logic and could break other valid selectors.
102
+
103
+
**Recommendation:** The parser must support CSS Nesting Module Level 1 relaxed nesting syntax:
104
+
- Selectors starting with combinators (`>`, `~`, `+`, `||`) must be parsed into proper selector AST structures
105
+
- These should be treated as compound selectors with the combinator as the first child
**Alternative approach:** If combinator-first selectors require special handling, consider:
109
+
- Adding a `is_relaxed_nesting` flag to indicate this syntax
110
+
- Providing the parsed combinator and following selector separately
111
+
- Or ensure the selector is parsed with the combinator as a proper `NODE_SELECTOR_COMBINATOR` node
112
+
113
+
**Priority:** CRITICAL - Breaks all modern CSS nesting with relaxed syntax, which is now standard
114
+
115
+
---
116
+
117
+
## 3. URL Function Content Parsing
118
+
119
+
**Current Issue:** The parser incorrectly splits URL values at dots. For example, `url(mycursor.cur)` is parsed as two separate keyword nodes: `mycursor` and `cur`, with the dot separator lost.
**Impact:****HIGH** - Colons can be valid separators in CSS values (particularly in `content` property). Dropping them corrupts the CSS syntax and changes semantic meaning.
174
+
175
+
**Workaround:** Currently impossible. The colon exists in the declaration's raw `text` property but requires fragile string parsing to detect and reinsert.
176
+
177
+
**Recommendation:** The parser should preserve colons as value nodes, likely as:
178
+
- `NODE_VALUE_OPERATOR` with `text: ':'`
179
+
- Or a new `NODE_VALUE_DELIMITER` type for non-mathematical separators
180
+
- This would maintain consistency with how other separators (commas, operators) are handled
181
+
182
+
**Priority:** HIGH - Breaks valid CSS with colons in value contexts
183
+
184
+
---
185
+
186
+
## 5. Attribute Selector Flags
62
187
63
188
**Current Issue:** Attribute selector flags (case-insensitive `i` and case-sensitive `s`) are not exposed as a property on `CSSNode`.
64
189
@@ -77,7 +202,7 @@ get attr_flags(): string | null // Returns 'i', 's', or null
**Current Issue:** Content inside pseudo-elements like `::highlight(Name)` is not accessible as structured data.
83
208
@@ -95,7 +220,7 @@ let content_match = text.match(/::[^(]+(\([^)]*\))/)
95
220
96
221
---
97
222
98
-
## 4. Pseudo-Class Content Type Indication
223
+
## 7. Pseudo-Class Content Type Indication
99
224
100
225
**Current Issue:** No way to distinguish what type of content a pseudo-class contains without hardcoding known pseudo-class names.
101
226
@@ -127,7 +252,7 @@ get pseudo_content_type(): PseudoContentType
127
252
128
253
---
129
254
130
-
## 5. Empty Parentheses Detection
255
+
## 8. Empty Parentheses Detection
131
256
132
257
**Current Issue:** When a pseudo-class has empty parentheses (e.g., `:nth-child()`), there's no indication in the AST that parentheses exist at all. `first_child` is null, so formatters can't distinguish `:nth-child` from `:nth-child()`.
133
258
@@ -149,7 +274,7 @@ get has_parentheses(): boolean // True even if content is empty
149
274
150
275
---
151
276
152
-
## 6. Legacy Pseudo-Element Detection
277
+
## 9. Legacy Pseudo-Element Detection
153
278
154
279
**Current Issue:** Legacy pseudo-elements (`:before`, `:after`, `:first-letter`, `:first-line`) can be written with single colons but should be normalized to double colons. Parser treats them as `NODE_SELECTOR_PSEUDO_CLASS` rather than `NODE_SELECTOR_PSEUDO_ELEMENT`.
155
280
@@ -169,7 +294,7 @@ if (name === 'before' || name === 'after' || name === 'first-letter' || name ===
169
294
170
295
---
171
296
172
-
## 7. Nth Expression Coefficient Normalization
297
+
## 10. Nth Expression Coefficient Normalization
173
298
174
299
**Current Issue:** Nth expressions like `-n` need to be normalized to `-1n` for consistency, but parser returns raw text.
175
300
@@ -190,7 +315,7 @@ else if (a === '+n') a = '+1n'
190
315
191
316
---
192
317
193
-
## 8. Pseudo-Class/Element Content as Structured Data
318
+
## 11. Pseudo-Class/Element Content as Structured Data
194
319
195
320
**Current Issue:** Content inside pseudo-classes like `:lang("en", "fr")` is not parsed into structured data. Must preserve as raw text.
0 commit comments