Skip to content
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

Treat :nth-of-type as a first class citizen #4

Open
venkatkarun opened this issue Mar 7, 2016 · 1 comment
Open

Treat :nth-of-type as a first class citizen #4

venkatkarun opened this issue Mar 7, 2016 · 1 comment

Comments

@venkatkarun
Copy link

I modified https://github.com/Autarc/optimal-select/blob/master/src/match.js#L259 locally to use nth-of instead of nth-child and it works great across multiple sites. Do you have any objections to incorporating this change directly in match.js as opposed to a later optimization in optimize.js. I will be happy to send a pull request if you think the change seems worthy and don't want to take it on yourself.

@autarc
Copy link
Owner

autarc commented Mar 7, 2016

At first I thought about using the nth-type-of selector in the initial matching as well - the problem is that its doesn't work in every case. For validation and comparison a simplified version of the css-selector-generator-benchmark is used. If you apply the generalization too early some tests will fail. Therefore the nth-child selector is used as the default fallback.
not-matching-selector

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

No branches or pull requests

2 participants