Why not NodeList#forEach :\?
bruant.d at gmail.com
Tue Jun 19 13:55:57 PDT 2012
Le 19/06/2012 18:21, Erik Arvidsson a écrit :
> On Tue, Jun 19, 2012 at 6:42 AM, 程劭非 <csf178 at gmail.com> wrote:
>> I guess we can try to push Web IDL to do this.
> WebIDL provides [ArrayClass] and DOM4 make NodeLists ArrayClass. This
> means that NodeLists have Array.prototype on its prototype chain.
Excellent! I hadn't heard of that.
> We tried to make this change in WebKit but it caused some issues,
> mostly on sites depending on a bug in Closure Library. The Closure bug
> has been fixed but the question is how many other sites out there do
> incorrect detection and therefore assume that anything that is an
> instance of Array is actually a true Array
I'll guess a quantity between "a lot" and "a ridiculous amount".
I read "if(something instanceof Array)" very often when view-sourcing
and they mean "Array.isArray(something)".
A trickier question is: will this code break the NodeLists inherit from
Array.prototype and that's harder to answer.
> My plan is to try again on Chrome Dev channel in the near future and
> see if we have better luck this time.
Good luck! I wish it'll work!
More information about the es-discuss