On Sat, Apr 7, 2012 at 8:41 PM, Domenic Denicola < [email protected]> wrote:
> On Apr 7, 2012, at 20:37, "Rick Waldron" <[email protected]> wrote: > > On Sat, Apr 7, 2012 at 8:31 PM, Erik Arvidsson <[email protected] > > wrote: > >> On Sat, Apr 7, 2012 at 17:28, Rick Waldron <[email protected]> >> wrote: >> > As in, its [[Class]] is "Array" and Array.isArray( nodes ) would >> evaluate to >> > true? >> >> No, it means that Object.getPrototypeOf(NodeList.prototype) === >> Array.prototype. >> > > Yes, this part was clear in the links you sent. The question I had was > about two things that were not addressed in the links (that I could see, > please correct if I missed them) > > There will be much confusion on the web if Array.isArray(nodes) returns > false, while nodes.push( node ), nodes.slice( 0, 2 ) "just work", > especially during periods of transition from DOMx to DOM4. > > > Rick > > > >> Fortunately all the Array.prototype methods are generic so it all just >> works. >> >> -- >> erik >> > > > I think the benefits are so great I'm happy to deal with any confusion. > > Although, it sounds like I'll be wanting to go back to `instanceof > Array`, which is kind of funny. > `instanceof Array` is unreliable across contexts (ie. frames) whereas Object.prototype.toString.call( thing ) === "[object Array]" is irrefutable... That said, I'm sure there is also plenty of code that that still expects Object.prototype.toString.call( nodelist ) === "[object NodeList]" (as unadvisable as that might be) Rick
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

