Re: Foster-parenting and taint

On Tue, 28 Apr 2009, Henri Sivonen wrote:
> On Apr 25, 2009, at 21:15, Ian Hickson wrote:
> > The spec is compatible with IE (and Opera) on this test:
> > 
> >   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/92
> > 
> > WebKit's behaviour (as you describe above) is not compatible with this.
> > 
> > (Ironically, Gecko's behaviour isn't compatible with IE. Not sure what's
> > going on there.)
> 
> Is there evidence that the Web needs the IE/Opera behavior, which my be 
> an unintentional artifact of achievin the foster parenting effect in the 
> CSS formatter rather than the HTML parser? On the face of it, it seems 
> undesirable to complicate parsing in order to cater for space-only 
> document.writes in tables.

Compatibility with IE is a goal here. While in the example above the write 
is contrived, it's easy to imagine cases where the document.write is 
trying to write something else (e.g. an element node) and happens to 
include the space as well, separate from the text nodes.

I'm also really not convinced that this complicates parsing. You can still 
buffer, either straight into a text node or into a separate buffer. If you 
make your tokeniser distinguish between space characters and non-space 
characters when it matters, you can easily handle that difference without 
an additional check in the tree constructor. An additional bit per table 
checked only when inside tables is not a big deal either.

Generally speaking I think it's very weird to have text nodes act 
differently based on where they are split by comments or elements.
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 28 April 2009 18:44:11 UTC