4 ms·
implemented in javascript: https://gist.github.com/jiaaro/7372006 https://gist.github.com/jiaaro/7372006
by jiaaro 13y ago
implemented in javascript:
https://gist.github.com/jiaaro/7372006 https://gist.github.com/jiaaro/7372006
- bazzargh 13y agoThere's a native way to avoid that recursion. var snap = document.evaluate('//text()', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null ); for (var i=0;i<snap.snapshotLength;i++){t=snap.snapshotItem(i);t.textContent = replace(t.textContent);} Also, the regexps would probably be better like /\belection\b/gi, to avoid eg reelection->reeating contest.
- JasonFruit 13y agoI think a reeating contest sounds . . . challenging.
- krrishd 13y agoCould you possibly minify it?