Class/id selector tokens in selector position: (line, ``.x`` | ``#x``).
(text: str)
| 230 | |
| 231 | |
| 232 | def css_selectors(text: str) -> list[tuple[int, str]]: |
| 233 | """Class/id selector tokens in selector position: (line, ``.x`` | ``#x``).""" |
| 234 | clean = _strip_css(mask_inactive(text)) |
| 235 | ln = _Lines(clean) |
| 236 | found: list[tuple[int, str]] = [] |
| 237 | start = 0 |
| 238 | for i, ch in enumerate(clean): |
| 239 | if ch in ";}": |
| 240 | start = i + 1 |
| 241 | elif ch == "{": |
| 242 | prelude = clean[start:i] |
| 243 | if not prelude.lstrip().startswith("@"): |
| 244 | _scan_prelude(prelude, start, ln, found) |
| 245 | start = i + 1 |
| 246 | return found |
| 247 | |
| 248 | |
| 249 | def _scan_prelude(prelude: str, base: int, ln: _Lines, found: list[tuple[int, str]]) -> None: |
no test coverage detected