【expression】 在CSS中降低效率的问题

CSS 内的 expression 会反复执行,有严重的效率问题。

解决方法:在 expression 中把 CSS 中用来触发的属性重写一下:

body{
zoom:expression(function(ele){
document.execCommand('BackgroundImageCache',false,true);
ele.style.zoom ='1';
}(this));
}

这里用 zoom 触发,搞定之后把 zoom 写回 1,这下就没效率问题了吧。同理,其他针对 IE 的 hack,如果是只跑一次的 expression,都可以这样做。

posted @ 2010-07-22 11:10  Younger  阅读(323)  评论(0编辑  收藏  举报