完全なコードはここで見つけることができますどのように説明することができます:http://www.webdeveloper.com/forum/showthread.php?t=224180#6これは機能のようにjqueryのをエミュレートします。次の部分は方法を定義しますは、誰かがこの部分
//define some methods for the utility:
var meths={
hide:function(a){if(a)a.style.display="none";},
show:function(a){if(a)a.style.display="";},
remove:function(a){if(a)a.parentNode.removeChild(a);},
color:function(a){a.style.color=this||a.style.color;},
size:function(a){if(a)a.style.fontSize=this||a.style.fontSize;}
};//end meths
私は上記の部分を取得します。これは、もちろん、閉鎖の一部です。私は、次の部分を理解しているようだとX.hide()
を呼び出す方法を誰かがこの
//bind the methods to the collection array:
for(var meth in meths)
(function(n,m){
output[n]=function(x){output.map(m,x); return output;}
}(meth, meths[meth]));//next method
return output;
説明するために、時間がかかる場合はXに対応するメソッドを呼び出すことはできませんどのようにこの部分何? –