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

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