JSLite / JSLite

与jQuery有着类似的api,让web开发更迅速,下载执行更快、量级更轻,针对现代高级浏览器的JavaScript库。

Home Page:http://jslite.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

对CSS这个方法改了一下,不加px也可以了

singod opened this issue · comments

对CSS这个方法进行了优化 ,看下面链接:
#19

你可以Pull requests 哦 @singod ,回头我看看。

for(k in property){ 
    //此处为添加的
    var prop = (typeof property[k]) == 'number' ? property[k] +'px' : property[k];
    css += k+':'+prop+';';
};

此处我改成

for(k in property) css += k+':'+(type(property[k])==="Number"?property[k]+"px":property[k])+';'; 
if(typeof property == 'string'){ css = property+":"+value;}
//此处为添加的
if(typeof property == 'string' && typeof value == 'number'){ css = property+":"+value+"px";}

此处我改成

if(typeof property == 'string') css = property+":"+(type(value)==="Number"?value+"px":value);

取消了优化了,我没有考虑 z-index 的情况,还没有想好怎么处理。

不要加这个,更严格点,我认为更好

@yanhaijing 我也这么认为,好像是滴哦,得好好研究研究。