Fixed issues with number of elements returned by selector in dom module

This commit is contained in:
Timothy Warren 2011-06-21 13:45:40 -04:00
parent a21c00f43a
commit e3cf259a93

34
kis.js
View File

@ -412,6 +412,12 @@
{ {
sel = _sel(sel); sel = _sel(sel);
if(sel.length < 2)
{
callback(sel);
return;
}
for(var x in sel) for(var x in sel)
{ {
callback(sel[x]); callback(sel[x]);
@ -436,10 +442,17 @@
hide: function(sel) hide: function(sel)
{ {
sel = _sel(sel); sel = _sel(sel);
this.each(sel, function(e){ if(sel.length > 1)
e.style.display = "none"; {
}); this.each(sel, function(e){
e.style.display = "none";
});
}
else
{
sel.style.display = "none";
}
}, },
show: function(sel, type) show: function(sel, type)
@ -451,9 +464,16 @@
type="block"; type="block";
} }
this.each(sel, function(e){ if(sel.length > 1)
e.style.display = type; {
}); this.each(sel, function(e){
e.style.display = type;
});
}
else
{
sel.style.display = type;
}
} }
}; };