Skip to content

Instantly share code, notes, and snippets.

@pgbovine
pgbovine / gist:8910348
Created February 10, 2014 04:25
JavaScript Gist for 6.813 Lecture 2
var result = document.evaluate("//text()", document.body, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null) ;for (var i = 0; i < result.snapshotLength; ++i) {var node = result.snapshotItem(i);if ((node.textContent+"").match(/\w/)&&node.parentNode.nodeName != "STYLE") {node.textContent = node.textContent.replace(/[A-Z0-9]/g, "X").replace(/[a-z]/g, "x");}}void 0