W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2010

Allow to return same NodeList object for queries like getElementsByTagName, getElementsByClassName and getElementsByName

From: Anton Muhin <antonm@chromium.org>
Date: Fri, 22 Jan 2010 16:11:40 +0300
Message-ID: <c42bef051001220511r53025b51p4955abd7c9c7de39@mail.gmail.com>
To: public-webapps@w3.org
Cc: Maciej Stachowiak <mjs@apple.com>
Good day.

Currently DOM core 3 spec is somewhat inconsistent regarding if
invocations of getElementsByTagName and alike must return a new
NodeList or could cache this list.  For Document it's mandated for
both getElementsByTagName and getElementsByTagNameNS, but for Element,
it's only worded for getElementsByTagNameNS, but not for
getElementsByTagName.  Maciej noticed as well difference between
getElementsByTagName and other getElementsBy queries (see
http://www.w3.org/Bugs/Public/show_bug.cgi?id=8792).  And word "new"
is missing from ECMAScript bindings spec:

Is it possible to allow caching for those cases?  Firefox caches those
node lists for a long time (Maciej found the related bug
https://bugzilla.mozilla.org/show_bug.cgi?id=140758).  IE8 caches as
well.   Opera, Safari and Chrome do not.

Performance-wise it's a notable win (the less js objects one needs to
create, the more efficient and less memory consuming browser one
gets).  Given that node lists are live, what are the reasons for
mandating creation of new object per query?

Received on Friday, 22 January 2010 15:42:31 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:22 UTC