CITguy / toggle-grayscale

Chrome extension to toggle between full color and grayscale
https://chrome.google.com/webstore/detail/toggle-grayscale/feefpfioflmdeinmmllkeemhmpagonlo
0 stars 0 forks source link

opportunity to improve performance #2

Closed CITguy closed 3 years ago

CITguy commented 5 years ago

document.body.style.* modifications seem to trigger a rather "lengthy" style recalculation. However, toggling a class on body (document.body.classList.toggle('.grayscale')) with pre-injected styles seems to drastically reduce the style recalculation (28ms vs 0.6ms).

CITguy commented 5 years ago

May be able to make use of constructed stylesheets (2019-06-13: Chrome only, atm).

CITguy commented 3 years ago

applying/modifying styles on <body> can affect stacking context of document content (see #4)