Skip to content

Commit fde1a78

Browse files
committed
Merge branch 'fix-qualified-rule-prelude-selector-parsing' into dev
2 parents 5e0e193 + 889e7ba commit fde1a78

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/csspring/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"""Parsing of CSS text aligned with [CSS] specification(s)."""
22

3-
def _enable_selector_parsing():
3+
def _enable_selector_parsing() -> None:
44
"""Augment parsing procedures to enable parsing of CSS selectors.
55
66
This adds on-demand parsing of the prelude part of every qualified rule (see the `prelude` attribute on `QualifiedRule`), when the `selector_list` property is accessed on the latter. Because parsing is only done when the property added with this procedure, is accessed, `csspring.syntax` remains compliant with its respective specification.
77
"""
8-
from .syntax.parsing import normalize_input, QualifiedRule
8+
from .syntax.parsing import normalize_input, Product, QualifiedRule, tokens
99
from .selectors import parse_selector_list
10-
def qualified_rule_selector_list(self):
11-
return parse_selector_list(normalize_input(self.prelude))
10+
def qualified_rule_selector_list(self: QualifiedRule) -> Product | None:
11+
return parse_selector_list(normalize_input(tokens(self.prelude)))
1212
setattr(QualifiedRule, "selector_list", property(qualified_rule_selector_list))
1313

1414
_enable_selector_parsing()

0 commit comments

Comments
 (0)