-
-
Notifications
You must be signed in to change notification settings - Fork 41
ComputeCurrentStyle should resolve CSS variables #62
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
Comments
I have just check chromes behavure when using window.getComputedStyle and that appears to resolve CSS variable's before returning. |
Thanks for checking @The-Nutty ! Yes, indeed it would be wonderful if you could look into this (to update the behavior of |
So in the document above in chrome Could add an extension method on CssStyleDeclaration that iterates through all decelerations and resolves var() expressions. This would require an extra method on CssStyleDeclaration like |
@FlorianRappl I have had another look at this and think it should be done during parsing at the same time we do things like |
Hm evaluating CSS variables during parsing does not sound right to me. The value of the CSS variable can only be determined at runtime when used in CSSOM, as the cascade is used to set the context-dependent value. Am I on the wrong track here? cc @The-Nutty |
No i do agree with you, im just trying to fit it into the current architecture, and it needs to happen before |
@FlorianRappl Have you had a chance to take a look at this? |
+1 for resolving css vars |
Landed in |
New Feature Proposal
Description
When using IElement.ComputeCurrentStyle i would expect CSS variables to be resolved for example when parsing the document:
I would expect
doc.GetDescendantsAndSelf().OfType<IHtmlParagraphElement>().First().ComputeCurrentStyle()["color"] == "#FFFFFF"
for example. But instead itsrgb(var(--color))
. However i would understand if ComputeCurrentStyle should not resolve CSS variables if thats the case i think it would be useful to have an extention method or utility that can do this.Is this something you are interested in adding or if you pointed me in the place you this method should belong i could have a crack at submitting a PR.
The text was updated successfully, but these errors were encountered: