3 ms·
WARNINGS apply: remember that any calculation in CSS is re-evaluated everytime the mouse moves, which means it's a bit performance issue.
by sametmax 10y ago
WARNINGS apply: remember that any calculation in CSS is re-evaluated everytime the mouse moves, which means it's a bit performance issue.
- majewsky 10y agoIt's a simple optimization to only reevaluate a formula when the constituent variables change (in these cases, the viewport sizes and root font size). I know that at least Qt Quick implements this optimization, and I would assume that browser developers already do that, too.
- amelius 10y agoYes, but browser vendors can choose whether they optimize it, so don't count on it!
- jordanlev 10y agoIs this true? I've never seen this mentioned anywhere, and some googling doesn't show me any mention of this. Do you have a reference to something that verifies this and/or explains it? I can totally understand how CSS expressions would be re-evaluated due to a repaint (resizing the window, manipulating DOM elements with javascript, etc)... but it doesn't make any sense that simply moving your mouse would cause this.
- solidr53 10y agoNot true. Read about reflow or layout trashing. Paul Irish has pretty complete list of what triggers repaint here: https://gist.github.com/paulirish/5d52fb081b3570c81e3a https://gist.github.com/paulirish/5d52fb081b3570c81e3a