[webkit-dev] Why so many text nodes in the DOM? (especially ones with just whitespace)

Eric Seidel eric at webkit.org
Wed Jun 16 14:52:10 PDT 2010


I wonder if any browser has investigated using a bool (or char or
whatever) on Element to mean "there is a \n text node after me" or
"there is a text node with N \n after me".  I'm not sure it would
actually be a win, and would certainly add code complexity to "lie" in
the DOM like that.  But it would be one way of getting rid of most of
these text nodes.

On Wed, Jun 16, 2010 at 2:12 PM, David Hyatt <hyatt at apple.com> wrote:
> Whitespace nodes most commonly occur between elements, so they can't be coalesced.
>
> dave
>
> On Jun 14, 2010, at 7:00 PM, Matt 'Murph' Finnicum wrote:
>
>> Why are there so many Text nodes in the DOM? I had a look at the initial DOM tree from rendering slashdot, and there are 1959 Text nodes. Of those 1959, 1246 were whitespace-only nodes.
>>
>> Does there need to be this many nodes? Why can't whitespace be combined with the nodes next to it?
>>
>> Thanks,
>> --Murph
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>


More information about the webkit-dev mailing list