W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2012

Re: Optimize setting textContent?

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 08 Feb 2012 15:32:43 -0500
Message-ID: <4F32DBEB.20001@mit.edu>
To: www-dom@w3.org
On 2/8/12 3:23 PM, Adam Klein wrote:
> But the current proposal, of reusing the first child if it happens to
> be a text node, seems particularly weird to me. For one thing, it
> would then be possible to remove all but one child of an element,
> whereas previously any operation that removed children either removed
> one or removed all.

I'm not sure that's true.  First of all, removing all but one child 
could report mutations one by one to the mutation observers.  But even 
if it does not, you can already remove arbitrary contiguous subsets of 
kids in an "atomic" operation via Range operations like deleteContents 
or extractContents.  Whatever those do wrt mutation observers is what 
"remove all but the first child" should do.  It could even be defined in 
terms of positioning a range and calling deleteContents on it, per spec.

Received on Wednesday, 8 February 2012 20:33:16 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:18 UTC