innerWidth does not account for scrollbar on safari 3.0.4
| Project: | Dimensions |
| Version: | 1.2.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Create a div with a nested div that has a height greater than the parent div. Set the overflow on the parent div to force a scrollbar. On firefox innerWidth of the parent will not include the scrollbar's width. On safari innerWidth on the parent and child divs will be the same. The expected result from innerWidth would be that the parent div would not include the scrollbar width as reported in firefox. The following snippet of code will illustrate the problem:
function scrollbarWidth() {
// revisit: as of JQUERY 1.2.3 this does not work on safari 3.0.
var div = $('');
// Append our div, do our calculation and then remove it
$('body').append(div);
var w1 = $('div', div).innerWidth();
div.css('overflow-y', 'scroll');
var w2 = $('div', div).innerWidth();
$(div).remove();
return (w1 - w2);
}
