[whatwg] Setting the "title" attribute

Ian Hickson ian at hixie.ch
Sat Aug 8 00:58:35 PDT 2009


On Thu, 7 Aug 2008, Jonas Sicking wrote:
> Robert O'Callahan wrote:
> > http://www.w3.org/html/wg/html5/#dom-tree
> > 
> >        1. If the |title| element
> >           <http://www.w3.org/html/wg/html5/#the-title1> is null, then a
> >           new |title <http://www.w3.org/html/wg/html5/#title1>| element
> >           must be created and appended to the |head| element
> >           <http://www.w3.org/html/wg/html5/#the-head0>.
> >        2. The children of the |title| element
> >           <http://www.w3.org/html/wg/html5/#the-title1> (if any) must
> >           all be removed.
> >        3. A single |Text| node whose data is the new value being
> >           assigned must be appended to the |title| element
> >           <http://www.w3.org/html/wg/html5/#the-title1>. 
> > 
> > Steps 1 and 2 can fire mutation events and cause "the title element" to
> > become null again. I suppose if that happens, the algorithm should stop, but
> > the spec should say so.
> 
> Actually, if we make the changes discussed to the mutation events spec, 
> we can consider setting the title a compound operation. This means that 
> mutation events won't fire until the above algorithm is fully done, so 
> any changes to the title element or attribute can simply be considered a 
> separate operation.

On Fri, 8 Aug 2008, Robert O'Callahan wrote:
>
> Yeah, this pretty much what Hixie said on IRC. Suits me.

Since it seems DOM3 Events isn't going to change mutation events in this 
manner, I've fixed the document.title algorithm to be safe against hostile 
mutation events.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list