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

core(font-size): fix CSS selector regex #13455

Merged
merged 2 commits into from
Dec 15, 2021
Merged

core(font-size): fix CSS selector regex #13455

merged 2 commits into from
Dec 15, 2021

Conversation

adamraine
Copy link
Member

@adamraine adamraine commented Dec 2, 2021

Resolves most of #12001.

@connorjclark
Copy link
Collaborator

connorjclark commented Dec 14, 2021

Is 8KB too much to pay to solve this + support paul's test cases? https://www.npmjs.com/package/css-selector-parser

@adamraine
Copy link
Member Author

Is 8KB too much to pay to solve this + support paul's test cases? npmjs.com/package/css-selector-parser

I played around with it real quick. You have to provide things like nesting operators yourself, and if we missed one it will throw on that operator. Also hasn't been updated in a while.

Might still be better then our regex system, but doesn't seem worth it to me. From the other PR:

that said, there are plenty of these test cases we still don't handle. I don't care a lot, but someone could have fun if they wanted. there's probably some stuff to pull from in this npm module keeganstreet/specificity, but it needs to be updated to include todays' :is() and :where() etc etc. but IMO it's pretty small ROI

@paulirish
Copy link
Member

I also wonder.... The devtools source doesnt determine specificity.. so i think they may rely on the order coming back from CDP to inform what rule applied? that would be an alternate approach.

@adamraine adamraine merged commit 2c15774 into master Dec 15, 2021
@adamraine adamraine deleted the css-regex-fix branch December 15, 2021 20:07
@connorjclark
Copy link
Collaborator

I also wonder.... The devtools source doesnt determine specificity.. so i think they may rely on the order coming back from CDP to inform what rule applied? that would be an alternate approach.

great catch. I confirmed this experimentally. pr incoming

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.

None yet

4 participants