Re: Flushing trailing text in document.write()

On Wed, 29 Apr 2009, Henri Sivonen wrote:
> On Apr 26, 2009, at 15:47, Ian Hickson wrote:
> > 
> > It's possible to have a text accumulation buffer in the tree builder 
> > without needing to flush it; just use the current text node's own 
> > buffer. (I believe this gets you the Firefox behaviour pretty 
> > cheaply.)
> 
> But you want IE behavior, not Firefox behavior. :-)

>From what I understand, the two behaviours are equivalent, except that 
IE's requires a few more checks occasionally.


> Also, using the node's buffer leads to a conflict between buffer growth 
> strategies that make minimize branches and reallocs for a tree builder 
> buffer and strategies that keep the memory footprint of the DOM nodes 
> compact.

You can "fix" the buffer each time you move on to another text node, or on 
a regular basis.

I'm not necessarily advocating any particular implementation strategy, I 
just don't buy that the spec's description is not implementable sanely.


> > > In any case, the implementation requirements aren't obvious from the 
> > > spec text. Even if the specced behavior stays as is, it would be 
> > > good to draw attention to the implications in this case.
> > 
> > Could you elaborate on how it's not obvious?
> 
> The interactions of various rules aren't obvious, because I 
> misunderstood the spec. :-) I've been developing software according to 
> the parsing section for a while now, and the design I came up with 
> independently matched the WebKit/Opera design, because I didn't realize 
> you had actually written spec text that taken as a whole has enough 
> constraints to happen to mean the IE behavior. (When starting this 
> thread, I thought the spec wanted the Firefox behavior.) Please call out 
> the implications in this case explicitly using examples. (On IRC, it 
> wasn't even obvious to you that the Firefox and IE behaviors were 
> distinct.)

It's still not obvious to me how they differ (I mean I know they differ 
in particular ways, but I don't understand the model Firefox uses to get 
its set of behaviours).

I've added some examples. The rules seem pretty clear to me though, so 
it's not clear to me what the confusion is about. If there are specific 
examples you would like to see that would clarify the aspects that you 
found confusing, that would be most helpful.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Wednesday, 29 April 2009 21:55:33 UTC