jaraco / jaraco/cssutils

Wrong specificity

Open
#50 2 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
Python
Stars
92
Forks
30
PR merge metrics
No merged PRs in 30d

Description

Hello,

I got wrong specificity on this selector `.form-floating > .form-control:focus ~ label::after`, with https://specificity.keegan.st/ I see 032 whereas with your tool 022

Script to reproduce :

```python
from cssutils import CSSParser

parser = CSSParser(parseComments=False, validate=None)
allrules = parser.parseString(
".form-floating > .form-control:focus ~ label::after{color:red}"
)
for el in allrules:
print(el.selectorList[0].specificity) # (0, 0, 2, 2)
```

Thanks

Contributor guide

No contributing guide indexed for this repository

Research direction

Run the provided CSSParser.parseString reproduction first, then trace how selectorList[0].specificity is calculated for the shown selector. Compare the result with the expected specificity from the linked calculator; done means the reported specificity is corrected and the reproduction no longer shows the discrepancy.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, python
Domain
tooling, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.