Thanks for the suggestion, but that sort of code is already in
getElementDimensions I think:

        if (disp == 'none' || disp == '' || typeof(disp) == 'undefined') {
            var s = elem.style;
            var originalVisibility = s.visibility;
            var originalPosition = s.position;
            var originalDisplay = s.display;
            s.visibility = 'hidden';
            s.position = 'absolute';
            s.display = '';
            var originalWidth = elem.offsetWidth;
            var originalHeight = elem.offsetHeight;
            s.display = originalDisplay;
            s.position = originalPosition;
            s.visibility = originalVisibility;
        } else {
            originalWidth = elem.offsetWidth || 0;
            originalHeight = elem.offsetHeight || 0;
        }

Only the "block/inline/whatever" part uses "". Which works nicely if
the style property is set on the element itself. But not on in the CSS
class.

So, I think we're still stuck... :-(

Cheers,

/Per

On Mon, Oct 27, 2008 at 12:44 PM, Andreas Marienborg
<[EMAIL PROTECTED]> wrote:
>
> On Oct 27, 2008, at 12:30 PM, Per Cederberg wrote:
>
>>
>> I just ran into a bug that I can't resolve. At least I'm out of ideas
>> right now:
>>
>>   http://trac.mochikit.com/ticket/325#comment:2
>>
>> The problem is when using getElementDimensions() on elements having
>> "display: none" set in the CSS class. Or in a parent element. Is there
>> a work-around for this? Or do we have to give up and just document
>> this?
>>
>
>
> You might have tried this, but I think we once did some trickery with
> visibility: hidden to get the size of display: none blocks.
>
> Basicly you set position: absolute and visibility: hidden, then change from
> display: none to display: block/inline/whatever
> Then you get the dimensions
> And set everything back
>
>
> - andreas
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to