Closed
Bug 271854
Opened 20 years ago
Closed 20 years ago
Parser incorrectly closes HTML comments on an XHTML 1.0 Transitional page
Categories
(Core :: DOM: HTML Parser, defect)
Tracking
()
VERIFIED
DUPLICATE
of bug 214476
People
(Reporter: aak1ra, Unassigned)
Details
User-Agent: Opera/7.54 (Windows NT 5.1; U) [en]
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040803
Hi, i stumped upon this bug during the editing of html page templates for a php
application i am building. I was editing in the html source the keywords that
php will replace with values, and was using the syntax below to denote content
replacement loop start/end points:
<code>
<!-- loop name=loop1 -- start -->
{varsToBeReplaced}
<!-- loop name=loop1 -- end -->
</code>
I'll provide you with some stripped down sample code to make easier to
replicate:
<code>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.
org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gecko HTML comments parsing bug</title>
</head>
<body>
<!-- loop -- start -->
<pre>
{var1}
{var2}
</pre>
<!-- loop -- end -->
</body>
</html>
</code>
I figured the use of the double minus '--' in the loop comment, made gecko's
parser to escape the closing comment tag that followed, and instead close the
comment on the next comment line it found.
If you run the code above, you'll see nothing on the screen. If the Doctype is
removed, you'll get the following output:
{var1}
{var2}
I didn't have other Doctypes readily available, so i didn't do any other tests.
All Gecko browsers i tested the page on exhibit the same incorrect behaviour -
netscape 6, mozilla 1.5, firefox 0.9. Also, i don't think this is a limitation
of XHTML, as all other browsers i tested (namely opera, ie) parsed the comments
correctly.
The simple workaround is not to use minuses in comments, but inside a comment it
should be irrelevant what you type because it's a comment, obviously.
Regards.
Reproducible: Always
Steps to Reproduce:
1. Create an .htm page using the source code i provided above.
2. Preview in mozilla
3. Preview in any other browser
4. Edit the source code, to remove the Doctype declaration.
5. Preview again.
6. Insert back the Doctype, and repeat the process playing with the minuses '--'
in the comment lines.
Actual Results:
The page with the Doctype declaration will produce no output. Removing the
Doctype, or removing the double minuses '--', displays the correct output in the
browser: {var1} {var2}
Expected Results:
See above
-
Comment 1•20 years ago
|
||
You have two dashes in a row inside the comment. See for bug 214476, why this
gives problems.
*** This bug has been marked as a duplicate of 214476 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Updated•20 years ago
|
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•