Closed Bug 291429 Opened 20 years ago Closed 20 years ago

Javascript Replace function bugs in case of Javascript1.2 statement

Categories

(Core :: JavaScript Engine, defect)

1.7 Branch
x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: anthony.groyer, Unassigned)

References

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 The following code replace the characters '(' and ')' by '\(' or '\)' in the string "fullscreen()". /////////////////// <HTML> <HEAD> </HEAD> <BODY> <SCRIPT LANGUAGE="JavaScript"> <!-- alert("fullscreen()".replace(/(\(|\))/gi,'\\$1')); //--> </SCRIPT> </BODY> </HTML> ///////////////// Now the following code returns "fullscreen\$1\$1" because of the "Javascript1.2" statement. It does not replace the $1 by the character '(' or ')' found. /////////////////// <HTML> <HEAD> </HEAD> <BODY> <SCRIPT LANGUAGE="JavaScript1.2"> <!-- alert("fullscreen()".replace(/(\(|\))/gi,'\\$1')); //--> </SCRIPT> </BODY> </HTML> ///////////////// I think this is a bug. Reproducible: Always Steps to Reproduce: 1.Just start the page to show the result of "replace" function 2. 3.
Bug 225409 suggests that JS1.2 is bad news!
Assignee: firefox → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → 1.7 Branch
This behavior happens for any version of javascript less than 1.5. This was fixed for js1.5 in bug 28686. On the trunk the language attribute of the script tag no longer emulates older versions of javascript, so this is not an issue for firefox 1.1 or seamonkey 1.0 in the future.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Depends on: 28686
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.