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:
http://www.w3.org/TR/DOM-Level-3-Core/ecma-script-binding.html

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?

yours,
anton.
Received on Friday, 22 January 2010 15:42:31 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:36 GMT