Closed
Bug 353041
Opened 19 years ago
Closed 19 years ago
JS: String.replace has bug handling substrings with ' and $
Categories
(Firefox :: General, defect)
Firefox
General
Tracking
()
RESOLVED
INVALID
People
(Reporter: qomo.team, Unassigned)
Details
Attachments
(1 file)
|
100 bytes,
text/html
|
Details |
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; zh-cn) AppleWebKit/418.8 (KHTML, like Gecko) Safari/419.3
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7
try this simple testcase
<script>
var v1 = "$from$";
var v2 = "'txt=$to$';";
alert(v1.replace("$from$", v2));
</script>
this should result 'txt=$to$';
but 'txt=$to$; in every Gecko engine till now
Reproducible: Always
Comment 2•19 years ago
|
||
According to the JS spec, $' in the replacement string equates to the portion of the source string after the matched part. To avoid this you would use "'txt=$to$$';" for the replacement string.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•