Did you know Chrome has a fast path that makes toggling descendant selectors super fast? So if you want to toggle a dark theme, or change some styles when the page is not scrolled to the top, by far the fastest way is to toggle a class on body like .scrolled or .dark-theme
-
Show this thread
-
Unfortunately css-in-js solutions and using React to implement things like this totally loses out on how fast your browser really is. body.classList.toggle('scrolled') is easily several times faster than even the smallest React render.
3 replies 34 retweets 97 likesShow this thread -
Your browser is capable of amazing things at 60fps if you're willing to be a little old school and step outside the VDOM component box and touch the DOM.
5 replies 25 retweets 127 likesShow this thread
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
& Web Standards TL; Blink API OWNER
Named PWAs w/
DMs open. Tweets my own; press@google.com for official comms.