W3C home > Mailing lists > Public > public-html@w3.org > November 2009

Re: Tree construction: Coalescing text nodes

From: Geoffrey Sneddon <gsneddon@opera.com>
Date: Fri, 13 Nov 2009 15:27:14 +0100
Message-ID: <4AFD6CC2.4020505@opera.com>
To: Henri Sivonen <hsivonen@iki.fi>
CC: Ian Hickson <ian@hixie.ch>, public-html@w3.org, pjt47@cam.ac.uk
Henri Sivonen wrote:
> On Nov 13, 2009, at 14:15, Geoffrey Sneddon wrote:
>> Henri Sivonen wrote:
>>> On Nov 13, 2009, at 12:06, Geoffrey Sneddon wrote:
>>>> However, I think that such implementations are probably more important in terms of the structure of the DOM created (because they are more likely to support scripting), and as such it seems silly to have anything apart from a single text node in all cases, especially when such implementations can likely have a single text node backed by multiple strings internally.
>>> It's not necessarily silly not to require browsers to coalesce in all cases. Would you make parser-inserted text nodes coalesce into script-created text nodes or parser-created older-than-previous text nodes that a script has moved around?
>> No, but I would expect the parser (without executing any script) to always create a DOM with no adjacent text nodes.
> Of course, it doesn't matter when scripts aren't executed. :-)

OK, let me change that to with no scripts that manipulate the DOM (even 
if they access it). Then it matters. :)

>> Surely the only additional time on top of the current spec is the foster parenting case (as the spec already requires coalescing text nodes in all other cases)
> When the AAA moves the existing children of a node and moves them to another node, is it ever possible to get adjacent text nodes that way?

No. (I don't have absolute proof, but having spent far too long looking 
at the spec and trying what I thought were interesting examples that 
might never caused adjacent text nodes, and every case I thought that 
might did not do so.)

Also, to note, it's not the case where it moves children that is 
interesting (it moves them into a new element and appends it in such a 
way that there can never be adjacent text nodes created in such a way), 
but the case where it removes last node from its parent.

Geoffrey Sneddon  Opera Software
Received on Friday, 13 November 2009 14:28:06 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:45:03 UTC