Skip to content

Fix specificity for :is and :where with a preceding selector#163

Closed
Herrtian wants to merge 1 commit intoscrapy:masterfrom
Herrtian:fix-is-where-specificity
Closed

Fix specificity for :is and :where with a preceding selector#163
Herrtian wants to merge 1 commit intoscrapy:masterfrom
Herrtian:fix-is-where-specificity

Conversation

@Herrtian
Copy link
Copy Markdown

@Herrtian Herrtian commented May 1, 2026

Fixes #136.

This keeps the specificity from the selector before :is() and :where(). The :is() argument specificity is still added using the most specific argument, while :where() only contributes zero for its own argument list.

Checked with:

  • uv run --with pytest --with lxml pytest tests/test_cssselect.py::TestCssselect::test_specificity -q
  • uv run --with pytest --with lxml --with sybil pytest tests -q
  • uv run --with ruff ruff check cssselect/parser.py tests/test_cssselect.py
  • uv run --with tox tox -e typing -- cssselect/parser.py tests/test_cssselect.py

@Herrtian Herrtian force-pushed the fix-is-where-specificity branch from 530c82d to fae08bc Compare May 1, 2026 15:20
@wRAR wRAR closed this May 1, 2026
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.

The specificity computation is wrong for :where and :is

2 participants