Re: Optimize setting textContent?

On Thu, Feb 9, 2012 at 9:23 AM, Adam Klein <adamk@chromium.org> wrote:

> On Wed, Feb 8, 2012 at 5:47 AM, Anne van Kesteren <annevk@opera.com>
> wrote:
> > In https://bugzilla.mozilla.org/show_bug.cgi?id=725221 roc (cc'd, not
> > subscribed to the list) suggests optimizing textContent by special casing
> > the scenario where the first child is a text node and the string being
> set
> > is non-empty. This would affect mutation observers and makes the setting
> > algorithm more complicated, but it is also a performance win (in some
> > implementations at least). Opinions?
>
> From the mutation observers point of view, I've got two opinions. I'd
> be ok with "if the _only_ child is a text node, replace its contents
> instead of removing it and creating a new text node".
>

That would be fine.

Rob
-- 
"If we claim to be without sin, we deceive ourselves and the truth is not
in us. If we confess our sins, he is faithful and just and will forgive us
our sins and purify us from all unrighteousness. If we claim we have not
sinned, we make him out to be a liar and his word is not in us." [1 John
1:8-10]

Received on Wednesday, 8 February 2012 21:15:56 UTC