W3C home > Mailing lists > Public > public-html@w3.org > December 2008

Conditional branch in tree builder based on DOM state

From: Henri Sivonen <hsivonen@iki.fi>
Date: Tue, 9 Dec 2008 17:50:27 -0800
Message-Id: <DB3EB08D-B756-48D6-BFD5-97200862B2F8@iki.fi>
To: HTMLWG WG <public-html@w3.org>

We had a meeting about moving parsing off the main thread in Gecko.  
The idea is to make the tree builder output a sequence of tree  
mutations on a dedicated thread and to actuate the mutations on the  
main thread.

It is then a problem if the sequence of mutations is conditional on  
information read synchronously from the DOM. There is one place in the  
HTML5 parsing algorithm where this problem arises and cannot be  
remedied by deferring the conditional check itself to the mutation  
actuation time: step 7.5. of the adoption agency algorithm. The  
changes to the internal state of the tree builder depend on whether a  
node has children.

The problem would go away if instead of checking whether the node has  
children in the DOM, there were a 'has children' flag on the tree  
builder stack tracking whether the node has *parser-inserted* children.

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——".

Henri Sivonen
Received on Wednesday, 10 December 2008 01:51:14 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:44:40 UTC