- From: Maciej Stachowiak <mjs@apple.com>
- Date: Tue, 02 Feb 2010 17:02:03 -0800
- To: Anton Muhin <antonm@chromium.org>
- Cc: public-webapps@w3.org
Hey folks, Any thoughts on this? I think it would be wise to issue an errata against DOM 3 Core to allow caching of NodeLists, and make sure to fix this in DOM4. IE and Firefox seem to do it, and it can be a big performance benefit, so I think the DOM spec should allow it. The three errata needed would be: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-A6C9094 Change return value of getElementsByTagName on Document from: "NodeList A new NodeList object containing all the matched Elements." To: "NodeList A NodeList object containing all the matched Elements." http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-getElBTNNS Change return value of getElementsByTagNameNS on Document from: "NodeList A new NodeList object containing all the matched Elements." To: "NodeList A NodeList object containing all the matched Elements." http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-A6C90942 Change return value of getElementsByTagNameNS on Element from: "NodeList A new NodeList object containing all the matched Elements." To: "NodeList A NodeList object containing all the matched Elements." If we agree to these errata, I would also suggest that related methods in HTML5 (getElementsByName, getElementsByClassName) should be consistent and should also not require a new NodeList every time. Does anyone disagree? Regards, Maciej On Jan 22, 2010, at 5:11 AM, Anton Muhin wrote: > 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 Wednesday, 3 February 2010 01:02:37 UTC