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

Re: Tree construction: Coalescing text nodes

From: Henri Sivonen <hsivonen@iki.fi>
Date: Tue, 17 Nov 2009 18:20:01 +0200
Cc: Ian Hickson <ian@hixie.ch>, public-html@w3.org, pjt47@cam.ac.uk
Message-Id: <9440EE6F-F542-4A20-8ADB-17B4E9B875DA@iki.fi>
To: Geoffrey Sneddon <gsneddon@opera.com>
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.

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/
Received on Tuesday, 17 November 2009 16:20:45 UTC

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