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

On Tue, 2 Nov 1999, Sean Richardson wrote:

> 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."

Yet another place where the 4.0 spec's "friendly prose" fails to state the
exact requirements.

> 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?

Yes, and yes.  'PCDATA' means 'parsed character data': data which has been
*examined* for markup and found to be data only (by elimination.)  i.e.  
the real issue is the parsing mode: whether the parser should have been
looking for any markup - comment declarations, processing instructions,
marked sections, references, *even* tags - at all.  '#PCDATA' says "yes"
(and further says that anything that *looks* like a tag is a reportable
error, because the content resulting from parsing must be text data only.)   

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

As does Opera 3.60.  They're all broken (or, perhaps, they've all
converged to a bug-for-bug consistency.)


Arjun

Received on Tuesday, 2 November 1999 19:36:45 UTC