Closed Bug 610920 Opened 14 years ago Closed 14 years ago

String.replace() takes the first arguments as a regexp instead of a string

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 587366

People

(Reporter: avernet, Unassigned)

Details

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b6) Gecko/20100101 Firefox/4.0b6 Build Identifier: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b6) Gecko/20100101 Firefox/4.0b6 More on String.replace() at: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/replace Reproducible: Always Steps to Reproduce: On Firefox 4b6, in the URL type: javascript:"g$ga".replace("$", "b", "g") Actual Results: g$gab Expected Results: gbga (which you get, say, in Firefox 3.6 or Chrome)
Works fine on trunk; I believe this was fixed since b6...
Whiteboard: DUPEEM
Whiteboard: DUPEEM → DUPEME
Yup, first argument was being interpreted as regular expression pattern in the three-argument replace form for a period of time -- it's been changed back to its historical behavior.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
Whiteboard: DUPEME
You need to log in before you can comment on or make changes to this bug.