Mozilla Firefox renders HTML comment incorrectly

Bug #593255 reported by ullix
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
firefox (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

Firefox incorrectly renders a comment as text, but only when the doctype is specified. The output is this:

before first after first
before second <!-- ---------------------------------------------------------- --> after second
before third after third

similar comments between before / after first and third are hidden correctly.

The error is present in Firefox for Ubuntu 3.6.3, but also in Firefox for windows 3.5.8. Internet Explorer 6.0 does it correctly, and so does Chromium 5.0.375.70 (48679) Ubuntu.

html code is attached

Revision history for this message
ullix (ullix) wrote :
ullix (ullix)
description: updated
Revision history for this message
Neil Perry (nperry) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. This bug did not have a package associated with it, which is important for ensuring that it gets looked at by the proper developers. You can learn more about finding the right package at https://wiki.ubuntu.com/Bugs/FindRightPackage . I have classified this bug as a bug in firefox.
(With many applications, you can report a future bug directly on the appropriate package by opening the application's "Help" menu and choosing "Report a Problem". https://wiki.ubuntu.com/ReportingBug

affects: ubuntu → firefox (Ubuntu)
Revision history for this message
ullix (ullix) wrote :

Neil,
finding a package is not as easy. Entering "Mozilla Firefox" gives you no hit at all, entering either "Mozilla" or "Firefox" gives "too many hits to show". Then what? Can this be taken as a recommendation to rework the package finder???

Revision history for this message
Micah Gersten (micahg) wrote :

Thank you for reporting this to Ubuntu. Please make sure your code validates before submitting a test case. The code isn't valid for the DTD type specified:
http://validator.w3.org/check

Changed in firefox (Ubuntu):
status: New → Incomplete
Revision history for this message
ullix (ullix) wrote :

I have used the validator to remove everything not related to the reported issue. The output now is this:

<!-- ---------------------------------------------------------- -->

For all I can say this is a proper comment consisting of a number of dashes, which I think is correct as it should not matter what I put as comment, yet the validator complains about a lot of things which are just follow-ups of an early issue, which is incorrectly declared to be an error.

Here is the code tested:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>mytitle</title>
</head>
<body>
<!-- ---------------------------------------------------------- -->
</body>
</html>

Revision history for this message
Micah Gersten (micahg) wrote : Re: [Bug 593255] Re: Mozilla Firefox renders HTML comment incorrectly

That code has 32 validation errors per the site I posted earlier.
Please resolve the errors and see if there's still an issue.

On 06/13/2010 10:09 AM, ullix wrote:
> I have used the validator to remove everything not related to the
> reported issue. The output now is this:
>
> <!-- ---------------------------------------------------------- -->
>
> For all I can say this is a proper comment consisting of a number of
> dashes, which I think is correct as it should not matter what I put as
> comment, yet the validator complains about a lot of things which are
> just follow-ups of an early issue, which is incorrectly declared to be
> an error.
>
> Here is the code tested:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
xmlns:v="urn:schemas-microsoft-com:vml">
> <head>
> <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
> <title>mytitle</title>
> </head>
> <body>
> <!-- ---------------------------------------------------------- -->
> </body>
> </html>
>

Revision history for this message
ullix (ullix) wrote :

To simplify further I changed the "comment" down to only 2 dashes: problem still exists for both firefox and the validator. this is the output:

<!-- -- -->

This is the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>mytitle</title>
</head>
<body>
<!-- -- -->
</body>
</html>

The problem disappears for both firefox and validator if the "comment" is further shrunk to only 1 dash. The web page is then blank.

This is the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>mytitle</title>
</head>
<body>
<!-- - -->
</body>
</html>

More than a single dash gives an error and incorrect rendering; this can't be right.

Revision history for this message
ullix (ullix) wrote :

Sorry, but the reported errors are erroneous as you can see by looking at the errors messages.

This is error-free:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>mytitle</title>
</head>
<body>
<!-- - -->
</body>
</html>

the validator reports:

Congratulations
The uploaded document was successfully checked as XHTML 1.0 Strict. This means that the resource in question identified itself as "XHTML 1.0 Strict" and that we successfully performed a formal validation using an SGML, HTML5 and/or XML Parser(s) (depending on the markup language used).

However, changing the comment from this <!-- - --> to this <!-- -- --> (now 2 dashes in the middle), results is this from the validator, declaring as error was had been ok before the change (the missing color makes it less obvious, better look in the validator directly):

Validation Output: 4 Errors

   1. Warning Line 8, Column 8: S separator in comment declaration
      <!-- -- -->

      This may happen if you have consecutive comments but did not close one of them properly. The proper syntax for comments is <!-- my comment -->.
   2. Error Line 10, Column 8: unterminated comment: found end of entity inside comment

      </html>

      Check that you are using a proper syntax for your comments, e.g: <!-- comment here -->. This error may appear if you forget the last "--" to close one comment, therefore including the rest of the content in your comment.
   3. Info Line 8, Column 9: comment started here
      <!-- -- -->

   4. Error Line 10, Column 8: end tag for "body" omitted, but OMITTAG NO was specified
      </html>

      You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
   5. Info Line 7, Column 1: start tag was here
      <body>

   6. Error Line 10, Column 8: end tag for "html" omitted, but OMITTAG NO was specified
     </html>

      You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
   7. Info Line 2, Column 1: start tag was here
      <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:v…

   8. Error Line 8, Column 5: Comment not terminated <!--
      <!-- -- -->

Revision history for this message
Micah Gersten (micahg) wrote :

Please read this:
http://www.w3.org/TR/REC-xml/#sec-comments

Multiple hyphens are not permitted in XML comments. Please report any other issues you may find.

Changed in firefox (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
ullix (ullix) wrote :

2.5 Comments
... For compatibility, the string " -- " (double-hyphen) MUST NOT occur within comments. ...

Sigh, not exactly intuitive.

But thanks for the learning experience :-)

Revision history for this message
Dima (shockkdv) wrote :

Hi !
It's true that the standart says that those symbols "MUST NOT occur" BUT !!! now you can use domains like losalbañiles.es with "Ñ" symbol and it convert's to xn--losalbailes-7db.es and what we have with this:

<!--a href="http://xn--losalbailes-7db.es" >...</a-->

We MUST have posibility to comment VALID URL !!!

I think it must work in Firefox. It works in all versions of IE, in Chromium and, i think, in Safary.

Can we reopen this bug ??

Revision history for this message
Dima (shockkdv) wrote :
Changed in firefox (Ubuntu):
status: Invalid → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for firefox (Ubuntu) because there has been no activity for 60 days.]

Changed in firefox (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.