Created
February 10, 2014 04:25
-
-
Save pgbovine/8910348 to your computer and use it in GitHub Desktop.
JavaScript Gist for 6.813 Lecture 2
This file contains hidden or 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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A example use case below: