cssutils icon indicating copy to clipboard operation
cssutils copied to clipboard

Wrong specificity

Open general03 opened this issue 1 year ago • 2 comments

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 :

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

general03 avatar Apr 30 '24 17:04 general03

Thanks for the report. I'm afraid I don't have the CSS expertise to even know which answer is right, but I'm happy to assume keegan.st is right. Would you or someone else be willing to investigate the cause and propose a solution?

jaraco avatar May 14 '24 20:05 jaraco

Thanks for your answser, I will try it

general03 avatar May 17 '24 15:05 general03