W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2013

Re: [whatwg] Proposal: Adding methods like getElementById and getElementsByTagName to DocumentFragments

From: Jonas Sicking <jonas@sicking.cc>
Date: Thu, 25 Jul 2013 13:42:51 -0700
Message-ID: <CA+c2ei8peSYB70U_xkz04A9bY_Lvzk=fvcALqbg8XTMUtbNe7g@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: WHAT Working Group <whatwg@lists.whatwg.org>
On Thu, Jul 25, 2013 at 9:05 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 7/24/13 10:42 PM, Jussi Kalliokoski wrote:
>> Argh, I had forgotten about live NodeLists. OK, this is a reason that
>> resonates with me and justifies calling these methods obsolete. Too bad
>> these methods are so badly flawed
> Fwiw, I think the performance impact of live NodeLists is ... unclear. Their
> existence does mean that you have to deal with DOM mutations changing the
> lists, but them being live also means you can make the list getters much
> faster in cases when the caller doesn't actually want the entire list.

And, as importantly, it also means that for multiple consecutive calls
to get the list, say inside of a loop, can return the same result
object. I.e. you don't have to re-walk the DOM for every iteration
through the loop.

/ Jonas
Received on Thursday, 25 July 2013 20:43:44 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:03 UTC