Re: Proposed errata for DOM2 Range regarding insertNode()

Ian Hickson wrote:
> DOM2 Range doesn't define anything to this level of detail yet, 
> unfortunately.

Indeed.  The wonders of Conway's Law...

Nevertheless, this question is somewhat important in terms of deciding where the 
range should be positioned.

> For example regular old insertions and deletions near 
> ranges cause changes to the range values but the spec doesn't say if this 
> is before or after the events.

I think it's pretty clear that it should be when the actual mutation occurs (so 
before the events for insert cases and after for removal cases), but that does 
mean that one can't implement Range on top of DOM MutationEvents.  Then again, 
there's no much one can implement on top of them, so that's OK, I think.

> It seems that for sanity we should say it happens before, if we specify 
> this. Should we do this as a separate errata?

I just wanted to point out that we have to be very careful in how we phrase this 
erratum (which I agree is a possibly useful one): we basically want to perform 
the insertion, then before firing the mutation event adjust the insertion 
endpoint after all the nodes we just inserted.  Or something.  In a UA that 
would fire multiple events here when inserting a DocumentFragment, we might lose 
no matter what we try to do.

-Boris

Received on Thursday, 15 May 2008 03:12:30 UTC