compat-table
compat-table copied to clipboard
For..of with HTMLCollection & NodeList
I think it would be nice to add these two tests.
HTMLCollection:
var result = 3;
var list = document.createElement("span");
for (var i= 0; i < result; i++) {
list.appendChild(document.createElement("span"));
}
var count = 0;
for (var item of list.children) {
count++;
}
return result === count;
NodeList:
var result = 3;
var list = document.createElement("span");
for (var i= 0; i < result; i++) {
list.appendChild(document.createElement("span"));
}
var count = 0;
for (var item of list.childNodes) {
count++;
}
return result === count;
This is the ECMAScript compatibility table - HTMLCollection and NodeList aren't part of ECMAScript.
Yep, although I've been meaning to add some of the browser-specific stuff as well coz I think it's super useful.
Perhaps in non-standard table or someplace else?
Some of the oldie tests of this type:
http://kangax.github.io/jstests/symbol-tostringtag/
http://kangax.github.io/jstests/es5-api-host-objects/
I think a browser-specific tab would be good, if it's another table - since many of the engines tested on the other pages include non-browsers.
Ok, HTMLCollection and NodeList are non-standard specifics of Collection and List. Add a tab for browser test is a good proposal for me.
@heycam anything else we can add?
You could add support for Elements which should be a subclass of Array, but that isn't finalised yet, I think.
Unlike NodeList
, I can't find anything about iterability HTMLCollection
in the specs.