Last active
August 29, 2015 14:19
-
-
Save simevidas/74a1d8a85fefe2cc74bc to your computer and use it in GitHub Desktop.
Logging CSS will-change usage on live sites
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Paste this into the browser’s JavaScript console | |
function walkTheDOM(node, func) { | |
func(node); | |
node = node.firstChild; | |
while (node) { | |
walkTheDOM(node, func); | |
node = node.nextSibling; | |
} | |
} | |
walkTheDOM(document.body, function (node) { | |
if (node.nodeType === 1) { | |
var willChange = getComputedStyle(node).getPropertyValue('will-change'); | |
if (willChange !== 'auto') { | |
console.log(`will-change: ${willChange} on element with dimensions: ${node.offsetWidth}x${node.offsetHeight}`); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment