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

Re: Tree construction: Coalescing text nodes

From: Jonas Sicking <jonas@sicking.cc>
Date: Tue, 17 Nov 2009 18:16:15 -0800
Message-ID: <63df84f0911171816j3da825efl59d2e9c89041a005@mail.gmail.com>
To: Henri Sivonen <hsivonen@iki.fi>
Cc: Geoffrey Sneddon <gsneddon@opera.com>, Ian Hickson <ian@hixie.ch>, public-html@w3.org, pjt47@cam.ac.uk
On Tue, Nov 17, 2009 at 8:20 AM, Henri Sivonen <hsivonen@iki.fi> wrote:
> I just realized I had written a bug that relates to coalescing foster-parented text.
>
> Consider: document.write("<table>  ");
>
> By the time the document.write() returns, it's impossible to decide if the spaces aren't going to get non-space characters in the same text node (and get foster-parented) or whether there's not going to be non-space characters (in which case the spaces shouldn't get foster-parented).
>
> I suggest not flushing the spaces when the document.write() returns and only flushing them lazily--that is, making document.write() flush trailing text only if the element on the stack isn't foster-parenting.

It seems more consistent to always flush. The only downside is that
some whitespace might get "misplaced" into a table, but this does not
seem like a big deal. And not flushing non-whitespace characters in
the case of  document.write("<table>foo") seems very unexpected.

/ Jonas
Received on Wednesday, 18 November 2009 02:17:08 UTC

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