resize-observer
resize-observer copied to clipboard
Investigate getComputedStyle performance
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 theseCSSStyleDeclarationobjects sitting there, makinggetComputedStylebasically just a property accessor?) - [ ] Does it become expensive to hold onto a bunch of "live"
CSSStyleDeclarationobjects? (For instance, if the object doesn't exist before callinggetComputedStyle, and updates values whether or not we check them, does it end up being worse for performance?)
#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.