Ticket #274 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Style.getElementDimensions in Safari 3 Make Element Disappear

Reported by: will@… Owned by: cederberg@…
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

Changed 2 years ago by cederberg@…

  • owner changed from somebody to cederberg@…
  • 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.

Changed 2 years ago by cederberg@…

  • 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].

Note: See TracTickets for help on using tickets.