Opened 16 years ago
Closed 16 years ago
#476 closed bug (fixed)
Opera curCSS bug
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | major | Milestone: | 1.1a |
Component: | core | Version: | 1.1a |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
In Opera (9, Mac), jQuery's css method returns property values in the units they were specified with in the stylesheet, rather than the computed value in pixels (like all other browsers).
For example: <p id="test" style="font-size: 1em">test</p>
$('#test').css('font-size')
Will return '1em', which isn't so useful.
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 that's supposed to be for IE only
} ...
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 :-)
Instead of introducing another browser vendor check I propose the following: change the order of the if/else conditions from:
to: