You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Don't call getComputedStyle as much as possible.
- Don't call it in a loop (multiple force render.)
- If you have to have do it.
a. do it at the debounce & after request animation frame. (Thus blink is already eval most of the data that you ask for.)
b. stamp the class that you are looking for rather than ask the style to get for it.
...Returned values are sometimes deliberately inaccurate. To avoid the “CSS History Leak” security issue, browsers may lie about the computed styles for a visited link, returning values as if the user never visited the linked URL...
The text was updated successfully, but these errors were encountered:
Tthe
getComputedStyle()
ends up forcing a layout redraw / reflow, see:In testing this really seems to happen on calls to
getPropertyValue()
as seen here:weaver-components/projects/wvr-elements/src/lib/core/theme/theme.service.ts
Line 78 in 05846d9
weaver-components/projects/wvr-elements/src/lib/core/theme/theme.service.ts
Line 109 in 05846d9
Consider the strategy from the referenced issues:
Not to mention, according to the specs (https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle) the values may be intentially incorrect.
The text was updated successfully, but these errors were encountered: