3 ms·
(It's a joke, with poor delivery it seems. It also pointlessly replaces things in <head>. Also, it clobbers every element on the page, attached event handlers i
by thesmallestcat 10y ago
(It's a joke, with poor delivery it seems. It also pointlessly replaces things in <head>. Also, it clobbers every element on the page, attached event handlers included, so it's expensive and destructive. To be clear, it's expensive because it treats the page as a string rather than using the DOM and replaces every element, not because regular expressions are expensive, which they aren't. As far as string replacements go, it's pretty quick. The underlying joke is it's a 1997 JS novice/Perl monk's attempt at replacing your O(n*m) script, which really needs no optimization, hence the dated <B> and "DHTML!"... I'll see myself out).