classilla / tenfourfox

Mozilla for Power Macintosh.
http://www.tenfourfox.com/
Other
270 stars 38 forks source link

Implement String.prototype.replaceAll #638

Open classilla opened 3 years ago

classilla commented 3 years ago

This actually could be useful for some of the other work we're doing. A simple-minded version would take str_replace in jsstr.cpp and make one that loops around. It should check that if it got a RegExp, that the global flag were set. This wouldn't be super fast but it would be a working first pass.

https://bugzilla.mozilla.org/show_bug.cgi?id=1540021 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll

classilla commented 3 years ago

js::str_flat_replace_string will replace all occurrences. We can just use that.