Skip to content

Less_Parser: Support comma-separated selector lists in pseudo-classes - #1

Open
elabx wants to merge 1 commit into
masterfrom
fix-nested-pseudo-selectors
Open

Less_Parser: Support comma-separated selector lists in pseudo-classes#1
elabx wants to merge 1 commit into
masterfrom
fix-nested-pseudo-selectors

Conversation

@elabx

@elabx elabx commented Mar 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix parsing of pseudo-classes (:is(), :not(), :where(), :has()) with comma-separated selector lists
  • Backport of Less.js 4.2 fix (less.js#4290)
  • Adds comma loop in parseElement()'s parenthesized-selector fallback, wrapping multiple selectors in an Expression node

Bug: wikimedia#136

Test plan

  • New fixture pseudo-selector-list covers :is(), :not(), :where(), :has(), and nested combinations
  • All 202 existing tests pass (15 skipped are pre-existing known failures)

🤖 Generated with Claude Code

@elabx
elabx force-pushed the fix-nested-pseudo-selectors branch 2 times, most recently from c13eae4 to 6268ad9 Compare March 3, 2026 18:43
Pseudo-classes like :is(), :not(), :where(), and :has() accept
comma-separated selector lists per CSS Selectors Level 4. The parser's
parenthesized-selector fallback in parseElement() previously called
parseSelector() which stops at commas, causing a parse error for inputs
like :is(.a, .b).

Add a comma loop in the paren fallback to collect multiple selectors,
wrapping them in an Expression node inside the Paren node. This mirrors
the upstream Less.js 4.2 fix (less.js#4290).

Bug: wikimedia#136

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@elabx
elabx force-pushed the fix-nested-pseudo-selectors branch from 6268ad9 to fac57db Compare March 3, 2026 18:54
BernhardBaumrock added a commit to baumrock/Less that referenced this pull request Jul 9, 2026
Backport :is()/:not()/:where()/:has() comma-separated selector parsing
from elabx/less.php#1, and native CSS color function passthrough for
rgba(..., var(...)) from wikimedia/less.php 5.5.0 (T405815).

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant