[Bug 22391] Sequence or Array

https://www.w3.org/Bugs/Public/show_bug.cgi?id=22391

--- Comment #11 from Boris Zbarsky <bzbarsky@mit.edu> ---
> I am no longer convinced this is a bad pattern, if done correctly.

For what it's worth, the usual arguments I've heard against live lists fall
into two categories:

1)  They're hard to iterate over: you have to make sure that nothing modifies
the list as a side-effect while you're iterating.  Here's a common pitfall
people fall into, for example:

  var kids = myNode.childNodes;
  for (var i = 0; i < kids.length; ++kids) {
    myNode.removeChild(kids[i]);
  }

2)  They impose a performance burden on implementations that have to update the
list whenever the set of things it reflects changes.  This is maybe
counterbalanced by the fact that live lists can sometimes do less work than
non-live ones (e.g. getElementsByTagName("foo")[0] doesn't have to walk the
whole DOM, just until it finds the first <foo>).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Wednesday, 10 July 2013 21:10:51 UTC