[Bug 17726] Enumerables on lists

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

--- Comment #1 from Erik Arvidsson <arv@chromium.org> 2012-07-09 21:28:52 UTC ---
It is considered bad practice to use for-in loops for arrays and array like
objects.

FWIW, "length" is non enumerable in IE and Firefox. It is enumerable in
WebKit/JSC, WebKit/V8 and Opera.

ES6 solves this using the for-of loop wich uses an iteration hook.
http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts. The right
thing to do is probably to spec that the default iterator of these things
should be that same as Array.prototype.iterator. which would allow us to do:"

for (var element of document.querySelectorAll('p')) {
  assert(element.tagName === 'P');
}

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Monday, 9 July 2012 21:28:53 UTC