W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2013

[Bug 22391] Sequence or Array

From: <bugzilla@jessica.w3.org>
Date: Wed, 10 Jul 2013 21:10:49 +0000
To: public-script-coord@w3.org
Message-ID: <bug-22391-3890-g4eX1X5eLr@http.www.w3.org/Bugs/Public/>
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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:50 UTC