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

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 UTC