JS Replace function working incorrectly

RESOLVED INVALID

Status

()

--
critical
RESOLVED INVALID
10 years ago
10 years ago

People

(Reporter: java.deepak, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

10 years ago
User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SU 3.1; QS 4.2.2.3; .NET CLR 1.1.4322)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11

Check this script:
<script language="javascript">
x = "$$john";
y = "~1";
result = "~1 hello";
result = result.replace(y, x);
alert(result);
</script>

in the output I loose one '$'  sign.It works fine in IE..
IE Output: $$john hello
Mozilla Output: $john hello

Can you please inform me by mail(java.deepak@gmail.com) what is the issue?

Reproducible: Always

Steps to Reproduce:
Run the script given in details
Actual Results:  
IE Output: $$john hello
Mozilla Output: $john hello

Expected Results:  
$$john hello

Comment 2

10 years ago
This might nonetheless get fixed in bug 432525.
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
No, we're not going to break our spec compliance in that bug, just improve the speed of what we do with flat-string replaces.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → INVALID
(Reporter)

Comment 4

10 years ago
Is there any way to escape this special pattern and replace a '$$' like value in an input string please? To support cross browser gets really tough at times. 

Since you guys already closed this can u please let me know by mail...i mean if you have some time to reply.
You need to log in before you can comment on or make changes to this bug.