- From: Adam Klein <adamk@chromium.org>
- Date: Wed, 8 Feb 2012 12:23:06 -0800
- To: Anne van Kesteren <annevk@opera.com>
- Cc: www-dom@w3.org, "Robert O'Callahan" <robert@ocallahan.org>, Stig Halvorsen <stighal@opera.com>
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". 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. Mutation observers could certainly support that case, but it seems, at the least, surprising. - Adam
Received on Wednesday, 8 February 2012 20:23:37 UTC