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)
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
Updated•22 years ago
|
Assignee: firefox → parser
Component: General → HTML: Parser
Product: Firefox → Browser
QA Contact: firefox.general
Version: unspecified → 1.7 Branch
Comment 1•22 years ago
|
||
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
| Reporter | ||
Comment 2•22 years ago
|
||
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 → ---
Comment 3•22 years ago
|
||
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 ago → 22 years ago
Resolution: --- → INVALID
Comment 4•22 years ago
|
||
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".
Comment 5•19 years ago
|
||
*** Bug 354669 has been marked as a duplicate of this bug. ***
Comment 7•19 years ago
|
||
So this is a bug in specefication:
How about:
<script type="text/javascript">
alert( '<script type="text/javascript" src="test1.js"></script>' );
</script>
You need to log in
before you can comment on or make changes to this bug.
Description
•