Re: [html] Elements within "title"?

On Tue, 27 Feb 2007, Lachlan Hunt wrote:

> For compatibility reasons in HTML, title cannot contain elements because of 
> the way it is parsed.

Compatibility with what? I guess you are thinking in terms of WHAT WG 
only, taking existing browsers as something that HTML needs to be 
compatible with. Actually I think some old versions of IE recognized some 
markup inside a <title> element, and current versions don't choke on it - 
they simply treat the markup as characters.

Logically speaking, you are saying that the <title> element cannot contain 
elements because it has #PCDATA content, i.e. because it cannot contain 
elements. It is true that changing this _could_ break pages on some 
existing browsers. It is also true that the restriction is artificial and 
in conflict with e.g. WAI guidelines (since lack of markup means that 
changes in language cannot be indicated).

> It would be possible to do so in XHTML, but then that 
> would be another incompatibility between the 2 languages

They are already completely incompatible, except in the trickery sense 
that you can masquerade XHTML 1.0 so that it will be eaten by existing 
browsers as the tag soup HTML that they can process.

> and there is also 
> limited usefulness in doing so anyway, since many of the use cases for title 
> are plain text.  e.g. the window's title bar, bookmarks, search results, etc.

There's no reason why markup (such as simple <em>) could not be useful in 
all of these use cases.

The real issue is whether the proposed extension would have too serious 
drawbacks on current browsers that (probably) parse the <title> content in 
a straightforward manner - which could actually vary, since a browser 
could treat "<" inside the content as error and stop there, or it could 
treat it as yet another character.

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

Received on Tuesday, 27 February 2007 11:45:05 UTC