Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function handleText(textNode)
- {
- textNode.nodeValue = textNode.nodeValue
- .replace(/Cloud/g, "Clown")
- .replace(/cloud/g, "clown")
- .replace(/CLOUD/g, "CLOWN")
- ;
- }
- function walk(node)
- {
- // thanks to: http://is.gd/mwZp7E
- switch (node.nodeType) {
- case 1: // Node.ELEMENT_NODE
- case 9: // Node.DOCUMENT_NODE
- case 11: // Node.DOCUMENT_FRAGMENT_NODE
- var child = node.firstChild;
- while (child) {
- var next = child.nextSibling;
- walk(child);
- child = next;
- }
- break;
- case 3: // Node.TEXT_NODE
- handleText(node);
- break;
- }
- }
- walk(document.body);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement