Closed
Bug 285147
Opened 19 years ago
Closed 19 years ago
Javascript parse error when using </script> tag within a literal string
Categories
(Firefox :: General, defect)
Tracking
()
People
(Reporter: mlevine, Assigned: bugzilla)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 If I use the </script> tag within a literal string (e.g. var new_html = "<script>var i = 0;</script>"), I get the error "Error: unterminated string literal" starting at "</script>". My only work around to this problem was to place the JavaScript in an eval() function. Reproducible: Always Steps to Reproduce: 1. Create a script block within an HTML page using <script language="javascript" type="text/javascript"></script>. 2. Within the script block add the following code: var inner_html = '<script>alert("Testing parse error ...");</script>'; 3. Load the HTML page in Firefox. 4. Open the JavaScript console to view the error. Actual Results: Some JavaScript text was displayed in the browser window and received the following error in the JavaScript console: Error: unterminated string literal Source File: file:///Users/marklevine/Desktop/test.html Line: 6, Column: 19 Source Code: var inner_html = '<script>alert("Testing parse error ..."); Expected Results: The string should have been parsed with no problems since it is just a string literal.
Comment 1•19 years ago
|
||
*** This bug has been marked as a duplicate of 32618 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•