Closed Bug 254606 Opened 22 years ago Closed 22 years ago

a "</script>" end tag is recognized within a "/* */" multiline comment

Categories

(Core :: DOM: HTML Parser, defect)

1.7 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: drkohles, Unassigned)

References

Details

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322) Build Identifier: Firefox/0.9.3 e.g. <script type="text/javascript"> .... /* comment about sctripts and tag usage ... </script> end of comment */ </script> html output "end of comment */" Reproducible: Always Steps to Reproduce: 1.simply include a </script> tag end within a multi line comment 2. 3. Actual Results: script terminates unexpectedly - this is apparently one a first pass as it doesn't complete other script contents Expected Results: ignored all information within multi line comments /* ignore me */ onad not prematurely terminated This problem prevents showing complete code examples in a multi line comment
Assignee: firefox → parser
Component: General → HTML: Parser
Product: Firefox → Browser
QA Contact: firefox.general
Version: unspecified → 1.7 Branch
This is the right behavior. The HTML parser needs to get the entirety of the script before it can pass it to the JS parser, and the HTML parser doesn't know anything about JS comments (nor should it).
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
update to clarify example: e.g. <script type="text/javascript"> <!-- .... /* comment about sctripts and tag usage ... </script> end of comment */ --> </script> html output "end of comment */" Note: use of "<!-- -->" should bypass checking within html parser (shouldn't it?)
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
No, it should not. The contents of <script> in HTML are CDATA, which means they are not parsed as HTML markup in browsers that understand the <script> tag. This is still invalid.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago22 years ago
Resolution: --- → INVALID
To clarify, see http://www.w3.org/TR/html401/types.html#type-cdata Unfortunately, terminating on the first "</" as the spec requires would also break far too many pages, so we terminate on the first "</script".
*** Bug 354669 has been marked as a duplicate of this bug. ***
So this is a bug in specefication: How about: <script type="text/javascript"> alert( '<script type="text/javascript" src="test1.js"></script>' ); </script>
That's invalid as well for the same reason, see bug 32618.
You need to log in before you can comment on or make changes to this bug.