Skip to content

improve specificity calculation #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2022

Conversation

romainmenke
Copy link
Member

https://drafts.csswg.org/selectors/#specificity-rules

The specificity of an :is(), :not(), or :has() pseudo-class is replaced by the specificity of the most specific complex selector in its selector list argument.

I misread this as being the sum, it is not.
It has to be the most specific.

In practice it being wrong will rarely lead to a different result.
So not prio for release

};

node.nodes.forEach((child) => {
const itemSpecificity = selectorSpecificity(child);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is why I was mentioning extracting since I've been seeing this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, each time I copy/paste a bit I remind myself that I should fine a way to have these imported from a central util bundle :D

Copy link
Member

@Antonio-Laguna Antonio-Laguna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm OK merging and releasing this, let me know if you want this.

Great work!

@romainmenke romainmenke merged commit 0309cc8 into main Jan 7, 2022
@romainmenke romainmenke deleted the specificity-fix--persistent-tree-frog-eaf83dd92b branch January 7, 2022 07:52
@romainmenke
Copy link
Member Author

if you want this.

I want it :)
thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants