W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2012

[dom] The "replace" algorithm doesn't deal with the case when child == node.prevSibling

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 01 Jun 2012 22:59:11 -0400
Message-ID: <4FC9817F.3030204@mit.edu>
To: www-dom@w3.org
I'm looking at 

Assume that on entry child == node.prevSibling.

In step 6, we set "reference child" to "node".

In step 7, we remove "node" from "parent".

In step 8, we remove "child" from "parent"

In step 9 we're supposed to "Insert node into parent before reference 
child with the suppress observers flag set.".  But "reference child" == 
"node", and it's no longer a child of "parent", as of step 7.  It's not 
clear to me what's actually supposed to happen in this case; the 
algorithm at 
seems to assume that "child" is a child of "parent".

Perhaps what should happen is that in step 6.5 if "reference child" is 
set to "node" it should be set to node.nextSibling?  What do UAs do?


P.S.  Actually, 
has a similar problem when "node" == "child".  Step 6 removes "node" 
(and hence "child") from "parent".  Step 7 tries to "Insert node into 
parent before child", but it's not clear how that's supposed to work in 
that situation.  Again, using a reference child which is child unless 
child == node, in which case it's child.nextSibling should probably fix 
the situation.
Received on Saturday, 2 June 2012 02:59:41 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:00 UTC