Re: Conditional branch in tree builder based on DOM state

On Dec 25, 2008, at 12:59, Ian Hickson wrote:

> On Tue, 9 Dec 2008, Henri Sivonen wrote:
[...]
>
>> The spec change suggestion, therefore, is making step 7.5. of the AAA
>> read "If node has any *parser-inserted* children, perform a shallow
>> clone of node——".
[...]
> While what you describe would make your particular implementation  
> strategy
> easier, it would in fact complicate implementations that support  
> script
> and operate on the DOM directly (i.e. all script-aware implementations
> today).

It would add a boolean flag to each stack node. The main complication  
seems to be the setting the flag, which is pretty tame. Granted, it  
does change the nature of the stack nodes a bit, since so far they've  
been immutable.

> Instead, I recommend passing along an _assertion_ along with the
> mutations, along the lines of "these elements have children" and  
> "these
> elements don't have children", which the main thread can quickly  
> check. If
> the assertions turn out to be false, which will only happen in rare  
> caes,
> then the thread can synchronise with the main thread, getting itself
> updated on what nodes have children, and then try again from that  
> point.

This seems a lot more complicated than requiring all implementations  
to maintain a flag on each stack node.

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/

Received on Friday, 2 January 2009 13:42:09 UTC