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

Re: Optimize setting textContent?

From: Robert O'Callahan <robert@ocallahan.org>
Date: Thu, 9 Feb 2012 10:15:20 +1300
Message-ID: <CAOp6jLY98hrdzM3cTvURWz74CjvbBYKivAfz8CNSqs+55+DrkQ@mail.gmail.com>
To: Adam Klein <adamk@chromium.org>
Cc: Anne van Kesteren <annevk@opera.com>, www-dom@w3.org, Stig Halvorsen <stighal@opera.com>
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.

"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
Received on Wednesday, 8 February 2012 21:15:56 UTC

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