HTML comments in <title> elements - valid or not?

A matter of implementation has cropped up regarding comments in <title>
elements. The gist of a bug report at bugzilla 
<URL:http://bugzilla.mozilla.org/show_bug.cgi?id=13015> is that Mozilla
is currently not parsing out comments *inside* the <title> element
(e.g., <TITLE><!--This title has a comment in it.-->This is the title</TITLE>
appears as "<!--This title has a comment in it.-->This is the title" in the
title bar) and it should be removing the comment before rendering. 

Now, aside from the obvious rejoinder, why not put the comment just before 
or just after that <title> instead? - how should this be handled?

According to <URL:http://www.w3.org/TR/REC-html40/struct/global.html#h-7.4.2>
"Titles may contain character entities (for accented characters, special 
characters, etc.), but may not contain other markup."

On the other hand, the following comment was made to the bug report:
"The content model of TITLE is #PCDATA, not CDATA, so comments are allowed, 
I think.  By other markup, the spec meant other elements." Is this latter
reading correct? In other words, are comments valid in <title> elements?

Or putting it pragmatically, should Mozilla look inside the <title>
for anything besides entities at all, or just spit it out as is?

(I've searched the www-html archive back to 1996 for "<title>" and found
no discussion of comments inside the element.)

For the record, both NN 4.7 and IE 5 show the comment in the title bar 
when displaying the bug reporter's testcase.

--
Sean Richardson   sidr@albedo.net

Received on Tuesday, 2 November 1999 12:04:47 UTC