Skip to content

Instantly share code, notes, and snippets.

@tim-smart
Created March 15, 2010 11:36
Show Gist options
  • Select an option

  • Save tim-smart/332760 to your computer and use it in GitHub Desktop.

Select an option

Save tim-smart/332760 to your computer and use it in GitHub Desktop.
var result = document.evaluate('.//text()',
document,
null,
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
null),
textNode,
i = 0;
while (textNode = result.snapshotItem(i++)) {
textNode.textContent = textNode.
textContent.
replace('replace me', 'with this');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment