2006-10-17 21:43 UTC The DOM0 Legacy: document.title
I'm trying to specify document.title
. Here's
a list of quirks and outright bugs that I have found so far:
- IE7
-
title
elements created by the parser don't have child nodes, but you can see their value in theinnerHTML
serialisation. (DOM-createdtitle
elements do have child nodes, however.)- Adding a
title
element via the DOM has no effect ondocument.title
.- The first
title
element that is parsed by the parser is associated withdocument.title
. If there is already such a node, then the new one is ignored by the parser.- Changing
document.title
changes the innerHTML of the associatedtitle
element, potentially creating one at the start of thehead
element if required.- Trying to append a child text node to the magic
title
element results in an exception being raised: "Unexpected call to method or property access".- Trying to change the magic
title
element'sinnerHTML
gives an "Unknown runtime error". - Adding a
- Firefox trunk
-
Setting
document.title
doesn't affect the DOM, and is sticky; further changes to the DOM no longer affectdocument.title
.- The first
title
element that the parser sees sets thedocument.title
value to the element'stextContent
. - The first
- Safari trunk
-
If a
title
element is inserted into the DOM, it is associated withdocument.title
, unless another node is already associated with it.- If the associated
title
element is removed from the document, it loses its association.- Setting
document.title
directly doesn't affect the DOM but sets an override that causes further accesses of that attribute to return the set value, until the set value is forgotten.- Appending things to the associated
title
element works per the DOM, and causes any override setting of thedocument.title
to be forgotten.- Setting a
title
element'sinnerHTML
attribute rasises aNO_MODIFICATION_ALLOWED_ERR
exception.- Getting
document.title
returns the concatenation of all the text node children of the associatedtitle
element, unless an override is in effect, in which case that is returned instead. - If the associated
- Opera9
-
In the parser, a
title
start tag doesn't imply ahead
start tag, nor dotitle
tags in the body end up as elements in thehead
.- Parsed
title
elements always have a text node child, even when that node is empty.- Setting
document.title
when there's notitle
element in the DOM does nothing, otherwise it deletes all the child nodes of the firsttitle
element in the DOM and then (if it wasn't set to the empty string) appends a single text node containing the new value.- Getting
document.title
returns the text of the first node (if it's a text node) of the firsttitle
element in the document (if there is one).- You can append a
title
element (or indeed any element) to theDocument
node, such that the document has more than one root node. - Parsed