On Sat, Apr 7, 2012 at 16:40, Rick Waldron <[email protected]> wrote:
>> var arr = document.getElementsByTagName("a");
>> var externalElms = arr.filter(function(acc, item) {
>> (/^https?:\/\//).test(item.href) });
>>
>> Or,
>>
>> var arr = document.querySelector("div")
>> var divMap = arr.fold(new Map, function(acc, item) { acc.add(item.id,
>> item); });
>
>
> Nit: You'd still need to convert the NodeList into an array before using any
> Array methods

FYI

DOM4 specs NodeList as an ArrayClass. This will be in ToT WebKit next
week. Enjoy :-)

http://www.w3.org/TR/2012/WD-dom-20120405/#interface-nodelist
http://dev.w3.org/2006/webapi/WebIDL/#ArrayClass
https://bugs.webkit.org/show_bug.cgi?id=81573

-- 
erik
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to