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

Jonas Sicking jonas at sicking.cc
Thu Jul 25 13:42:51 PDT 2013

On Thu, Jul 25, 2013 at 9:05 AM, Boris Zbarsky <bzbarsky at 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

More information about the whatwg mailing list