Re: Drop foster-parented stuff on the floor if parent gone

On Feb 1, 2009, at 10:52, Ian Hickson wrote:

> On Wed, 31 Dec 2008, Jonas Sicking wrote:
>>
>> An ideal algorithm would be something like this:
>> 1. Find the last table in the stack of open elements.
>> 2. Find the element in the stack of open elements that is right  
>> before
>> the last table in the stack of open elements. (this is generally the
>> parent of the table unless the DOM has been mutated)
>> 3. If an element was found in both 1 and 2, and the the table found  
>> in
>> 1 is a child of the element found in 2, insert the new node before  
>> the
>> table found in 1 and exit the algorithm.
>> 4. If an element was found in 2, append the new node to 2 and exit  
>> the
>> algorithm.
>> 5. Otherwise drop the node.
>
> Ok, I've done that instead.

I implemented this change.

It breaks compat with Firefox and Safari and it isn't consistent with  
IE8 or Opera, either.

The problem is this:
<a><table><a>
The second <a> removes the first from the stack before foster  
parenting runs, so the stack parent and the tree parent of table  
differ and the second <a> goes below the table instead of getting  
inserted above it.

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

Received on Monday, 23 February 2009 13:40:18 UTC