我被一个愚蠢的问题困住了。下面是我获取 dom 的计算样式的代码。它在 FireFox 甚至 IE 上运行良好(惊讶)!但在 chrome v17 上速度太慢(慢 20 倍)。如何避免问题?
getCurrentStyle = function(el)
{
if (el.currentStyle)
return el.currentStyle;
else if (window.getComputedStyle)
return document.defaultView.getComputedStyle(el,null);
return null;
}
请帮忙!