#3505 new

function getDimensions(element) returns width: 0 in a rare case in IE10

Reported by Jonathan | August 19th, 2013 @ 01:50 PM

It's a timing issue, any line of code inserted before the IF statement fixes the issue.
Issue is IE10 only.

function getDimensions(element) {
    element = $(element);
    var display = Element.getStyle(element, 'display');

    for (var i = 0; i < 10; i++) // Fixes a rare issue where IE10 returns a width of 0 when display is true but element is still being rendered.
        if (element.offsetWidth && element.offsetHeight)

    if (display && display !== 'none') {
        return { width: element.offsetWidth, height: element.offsetHeight };


Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins

People watching this ticket