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

Investigate getComputedStyle performance #9

Open
5 tasks
devrelm opened this issue Aug 10, 2018 · 1 comment
Open
5 tasks

Investigate getComputedStyle performance #9

devrelm opened this issue Aug 10, 2018 · 1 comment

Comments

@devrelm
Copy link
Owner

devrelm commented Aug 10, 2018

It looks like getComputedStyle returns a "live" CSSStyleDeclaration that automatically updates its properties.

It'd be nice to check out how we could use this to our advantage for performance, or whether it might be unnecessary or even bad to do so.

To Do:

  • What do the specs say?
  • How do browsers behave?
  • Can we cache the CSSStyleDeclaration?
  • Is it even that expensive to call getComputedStyle? (For instance, does the browser already have all these CSSStyleDeclaration objects sitting there, making getComputedStyle basically just a property accessor?)
  • Does it become expensive to hold onto a bunch of "live" CSSStyleDeclaration objects? (For instance, if the object doesn't exist before calling getComputedStyle, and updates values whether or not we check them, does it end up being worse for performance?)
@devrelm
Copy link
Owner Author

devrelm commented Aug 10, 2018

#10 switched us from using getBoundingClientRect to getComputedStyle.

However, there's a possibility that this will actually result in incorrect values, so we may want to look into using clientWidth and clientHeight instead.

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

No branches or pull requests

1 participant