Standards compliance mode: <!-- -- --> in <head> shown as text in body

RESOLVED INVALID

Status

()

RESOLVED INVALID
14 years ago
14 years ago

People

(Reporter: aboulart, Unassigned)

Tracking

({testcase})

Trunk
x86
Windows 2000
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040707 Waterlizard/0.8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040707 Firefox/0.8

The page shows the line:
-- [#BADPASS=ERROR: Invalid password#] [#---#] -->
above what should be the page's title:
courier 0.37.3 - Administrative Login

When looking at the HTML source in Firefox, you can see that the line in
question should be part of an HTML comment, but it starts with "--" instead of
"<!--". 

The "<!-- ... -->" comment is actually correct in the original file. If you open
the same page with Internet Explorer, the page will render correctly and the
HTML source will be valid. 

So, somewhere along the line, it seems that Firefox swallows the two characters
"<!" that open this comment. 

Note that this also happens with Firefox 1.0 under Linux. FYI, the CGI that
generates this HTML is the Courier web admin interface, package courier-webadmin
in Debian stable. Every page generated by that CGI is affected. 

Reproducible: Always

Steps to Reproduce:
1. Install courier-webadmin debian package 
-or-
1. Open static copy at http://entry-802.nine.ch/courierwebadmin
2. Notice first line that shouldn't be there

Actual Results:  
I cried. :)

Expected Results:  
Keep HTML comments hidden from me.

Comment 1

14 years ago
Maybe dupe of Bug 214476 (not sure, since the whole comment appears on the
page), but for sure invalid.

Comment 2

14 years ago
Created attachment 180054 [details]
invalid comment in head

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>289542</title><!--  -- --></head>
<body></body></html>


The comment <!--  -- --> is seen in the body as text, also in DOM Inspector.
(Reporter)

Comment 3

14 years ago
OK, I now understand that the "---" inside the comment will screw up the
rendering somehow. 

But why does the "<!" disappear from the HTML source window? I thought it was
supposed to display the document's code exactly as received from the server. 

Comment 4

14 years ago
(In reply to comment #3)
> But why does the "<!" disappear from the HTML source window? I thought it was
> supposed to display the document's code exactly as received from the server. 

Here it displays it. Maybe a bug of FF 0.8 (FF 0.8 is somewhat out-of-date).

(Reporter)

Comment 5

14 years ago
(In reply to comment #4)
> Here it displays it. Maybe a bug of FF 0.8 (FF 0.8 is somewhat out-of-date).

Just tested on Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041129
Firefox/1.0 (Debian package 1.0-3.backports.org.1) and it still gives me the
below. Unfortunately I can't upgrade to anything newer. I guess it has been
fixed in a later version. Thanks for your explanations.  

  <title>courier 0.37.3 - Administrative Login </title>
  --
  [#BADPASS=ERROR: Invalid password#]

  [#---#]
  -->
</head>

Comment 6

14 years ago
Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8b2) Gecko/20050408

I´m seeing the bug in the minimal testcase in a current trunk build.

The testcase renders in Standards compliance mode, but doesn´t validate:
http://validator.w3.org/check?uri=https%3A%2F%2Fbugzilla.mozilla.org%2Fattachment.cgi%3Fid%3D180054&charset=%28detect+automatically%29&doctype=%28detect+automatically%29&verbose=1

Complete source of testcase shown in comment #2.

 <!-- -- --> is the minimal comment producing this behaviour.

about HTML comments:
http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4
http://www.htmlhelp.com/reference/wilbur/misc/comment.html

about SGML comments:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/fdp-primer/sgml-primer-comments.html
http://lists.w3.org/Archives/Public/html-tidy/2000OctDec/0206.html

seeing  <!-- A -- B --> as SGML comment, ' A ' is inside the SGML comment, ' B '
is outside the SGML comment, and '>' again is inside the SGML comment, so not
seen as the end of the html comment.
This may be an explanation for the error message from validator, but doesn´t
explain why the comment in the <head> is seen as text in the <body>.
That´s what I see in the links above, I don´t know much about markup languages.

Keywords: testcase
Summary: opening <! of html comment tag disappears, page not rendered right → Standards compliance mode: <!-- -- --> in <head> shown as text in body
(In reply to comment #6)
> explain why the comment in the <head> is seen as text in the <body>.

When we come across an unterminated comment (such as <!-- -- -->), we consume it
as text (to imitate IE). Note, however, that IE does not follow the specs when
parsing comments, so it thinks the comment is terminated. Once we consume the
comment as text, it's text in the <head> section, so it gets moved down to the
<body>.

Note that Firefox 1.0 is also out of date! The bug where <! disappered on
unterminated comments was bug 144902 and that was fixed by the checkin for bug
88952. I'm marking this INVALID.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.