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.
/ Jonas