I solved this problem if you are still interested. The solution is quite complicated. Basically, you need to attach a simple element to the element and cache its clientWidth / Height.
A simple HTC looks like this:
<component lightweight="true"> <script> window.clientWidth2[uniqueID]=clientWidth; window.clientHeight2[uniqueID]=clientHeight; </script> </component>
You need to connect HTC using CSS:
.my-table td {behavior: url(simple.htc);}
Remember that you only need to attach behavior for IE8!
Then you use JavaScript to create getters for cached values:
var WIDTH = "clientWidth", HEIGHT = "clientHeight"; if (8 == document.documentMode) { window.clientWidth2 = {}; Object.defineProperty(Element.prototype, "clientWidth2", { get: function() { return window.clientWidth2[this.uniqueID] || this.clientWidth; } }); window.clientHeight2 = {}; Object.defineProperty(Element.prototype, "clientHeight2", { get: function() { return window.clientHeight2[this.uniqueID] || this.clientHeight; } }); WIDTH = "clientWidth2"; HEIGHT = "clientHeight2"; }
Note that I created the WIDTH / HEIGHT constants. You should use them to get the width / height of your elements:
var width = element[WIDTH];
It is complicated, but it works. I had the same problem as you, access to clientWidth was incredibly slow. This solves the problem very well. It is still not so fast with IE7, but it can be used again again.
Dean edwards
source share