2010-03-09から1日間の記事一覧

javascript:[].forEach.call(document.querySelectorAll("a.keyword"),function(node){node.outerHTML=node.innerHTML}) http://twitter.com/javascripter/statuses/10020660290

Function.prototype.call()

具体的には console.log( Array.prototype.join.call(document.links,'\n') ); みたいに、配列っぽい振る舞いをするオブジェクトに配列用のメソッドを使えるようになる。便利。 http://d.hatena.ne.jp/javascripter/20080421/1208746032 document.links.join…

[].forEach.call(nodes, function (item) { } )

Hi, I'm a big fan of using the forEach method on nodeLists like this: var nodes = document.querySelectorAll(".foo"); [].forEach.call(nodes, function (item) { //do stuff with item }); I was wondering though, does doing it that way take long…