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

Re: Optimize setting textContent?

From: Olli Pettay <Olli.Pettay@helsinki.fi>
Date: Wed, 08 Feb 2012 19:47:12 +0200
Message-ID: <4F32B520.70105@helsinki.fi>
To: Anne van Kesteren <annevk@opera.com>
CC: www-dom@w3.org, "Robert O'Callahan" <robert@ocallahan.org>, Stig Halvorsen <stighal@opera.com>
On 02/08/2012 03:47 PM, Anne van Kesteren 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?

Quite horrible special case. APIs should be consistent whenever possible.
innerHTML has the same behavior as textContent. When setting
textContent/innerHTML, all the existing nodes are removed.

Received on Wednesday, 8 February 2012 17:51:37 UTC

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