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

Russell Steven Shawn O'Connor wrote:
> 
> On Mon, 8 Nov 1999, Dan Connolly wrote:
> 
> > Perhaps we should have added a NOTE about why this restriction is there:
> > it's there because older HTML implementations treated <!--...---> as
> > character data, and I think some versions of the HTML spec declared
> > the TITLE element as CDATA. So there are known interoperability
> > problems,
> > so authors are prohibited from going there.
> 
> Why did you not also add the restriction that `<' must be escaped by using
> an entity.

Er.. I don't know. I suppose it didn't seem necessary...
Note that title being #PCDATA means that < _may_ be written as &lt;
in <TITLE>...</TITLE>, and I think the HTML spec goes further and
says it _should_ be written that way. Hmm... I don't see it
right away, but this footnote seems relevant:

"There are SGML mechanisms, CDATA and RCDATA declared content, that
allow most `<', `>', and `&' characters to be entered without the use of
entity
references. Because these mechanisms tend to be used and implemented
inconsistently, and because they conflict with techniques for reducing
HTML to
7 bit ASCII for transport, they are deprecated in this version of HTML.
See
section Example and Listing: XMP, LISTING. "
http://www.w3.org/MarkUp/html-spec/html-spec_foot.html#FOOT5

(I don't know where the corresponding text in HTML 4.0 is right off
hand)

>  For if TITLE was CDATA then `<X' would be illegal for suitable
> X, but it would be legal under HTML 4.0.  By the same reasoning `<' should
> be escaped under most condiditions in HTML 4.0

Yes, it should.

-- 
Dan Connolly, W3C
http://www.w3.org/People/Connolly/

Received on Monday, 8 November 1999 12:15:20 UTC