Ok, I did a little bit of digging, and it looks like this is actually a
bug. In the curCSS function, on line 452 (r627), there's a check
for elem.currentStyle :

} else if(elem.currentStyle) {
// stuff only ie should see
}

Apparently, this property exists in Opera, but contains the bogus
values. If that check is changed to:

} else if(elem.currentStyle && !window.opera) {

Then opera will use getComputedStyle and return the correct values, in 
pixels :-)

I've submitted a ticket here:
http://jquery.com/dev/bugs/bug/476/

Luke

Dave Methvin wrote:
>> I ran into a bit of an odd problem this morning: $.css returns 
>> values in whatever units they were set with in the stylesheet 
>> (Safari and Firefox both return values in px regardless of how they
>> were defined). ... As a workaround, I'm inserting an element ...
>> Then measuring it Is there a better way of getting pixel values fox
>> css properties in Opera?
> 
> I have run into the problem with IE and css properties like
> padding-left or border-right-width.
> 
> Your trick of measuring an element's width only works if there is no
> padding on the element. Even then it doesn't work if a parent element
> is currently hidden, rendering the measured element hidden as well.
> So, as far as I know there is no jQuery core solution to this issue.
> 
> 
> Long ago, I played with mods to .css() to get reliable pixel
> measurements for all those properties, but it got complicated and
> seemed like a performance nightmare. A simple call like
> .css("border-left-width") could be very slow, and often you'd be
> making several calls to get all four borders. Brandon later built the
> dimensions plugin and its approach of getting multiple properties at
> once seems like the right way. It's probably best to extend
> dimensions.js if this is widely needed functionality.
> 
> 
> _______________________________________________ jQuery mailing list 
> [email protected] http://jquery.com/discuss/


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to