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): use order from protocol as implicit specificity #13501

Merged
merged 4 commits into from
Nov 29, 2022

Conversation

connorjclark
Copy link
Collaborator

@connorjclark connorjclark commented Dec 15, 2021

Fixes #12001

Turns out that the order on the protocol for CSS.getMatchedStylesForNode is from least to most specific, so we don't need to calculate specificity ourselves. Only need to filter to the rules we care about (based on what properties they contain) and pick the last.

I don't think adding various tests in the smoke to really confirm this is too useful–we should just rely on it being a given, as DevTools depends on it. To confirm it works, I am first putting up a draft PR that keeps the current implementation and asserts when the simpler approach does not match. This should pass in all the simpler cases we already support, and only fail for the complex stuff we don't yet support. I ran it on cnn.com, theverge.com, and other big sites and got no errors. The smoke tests seo perf also still work.

@connorjclark
Copy link
Collaborator Author

I update this PR last week - should be good.

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.

Use universally correct CSS specificity
4 participants