Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Replaces all text on a page with the font size. Useful for debugging the page or just replacing wretched content with something less awful.
(function() {
var n,
walk = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null, 0);
while (n = walk.nextNode()) {
if (n.textContent.trim().length > 0)
n.textContent = window.getComputedStyle(n.parentNode).fontSize;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment