Ticket #274 (closed defect: fixed)

Opened 10 months ago

Last modified 4 months ago

Style.getElementDimensions in Safari 3 Make Element Disappear

Reported by: will@onnyturf.com Assigned to: cederberg@gmail.com
Priority: normal Milestone: MochiKit 1.4
Component: component1 Version:
Severity: normal Keywords:
Cc:

Description

Noticed a bug on Style.getElementDimensions when testing in Safari 3. Looks like calling it on an element sets its display property to none. Setting it back to block after the call brings the element back into view.

Change History

03/30/08 09:06:56 changed by cederberg@gmail.com

  • owner changed from somebody to cederberg@gmail.com.
  • status changed from new to assigned.
  • milestone set to MochiKit 1.4.

I recall seeing something similar a while ago, but I thought it was an error on my side. Anyway, now I cannot reproduce this issue with Safari 3.1. Could you please check if this is still happening? And if so, please send us a minimal HTML file that shows the problem. Thanks.

04/01/08 11:42:15 changed by cederberg@gmail.com

  • status changed from assigned to closed.
  • resolution set to fixed.

Now confirmed to be a problem in MochiKit for Safari 3.1. The following condition in getElementDimensions() returns immediately only when the display property is set:

        if (disp != 'none' && disp !== '' && typeof(disp) != 'undefined') {
            return new self.Dimensions(elem.offsetWidth || 0,
                elem.offsetHeight || 0);
        }

It seems that when an element has been added very recently, the display property might still be empty in Safari. So calling getElementDimensions() on such an elemen will then assume that the uninitialized display value is an old Safari bug where '' meant 'none' (see #149).

I've added a test case that reproduces the issue and committed a fix in [1355].