ded / bonzo

library agnostic, extensible DOM utility
Other
1.32k stars 137 forks source link

IE7/8 width getter #15

Closed Demwunz closed 13 years ago

Demwunz commented 13 years ago

In IE7 and 8, if I run something like this:

var itemsWidth = 0;
$('li').each(function (el) {
     var width = $(this).width();
    itemsWidth += width;
});

IE will return a value of 'auto' for the width unless it is explicitly set in CSS. This is a bit of a problem when you are running over items that you don't know the content of and need to set the parent object's width dynamically.