Side navigation
#476 closed bug (fixed)
Opened December 08, 2006 12:53AM UTC
Closed December 11, 2006 09:25AM UTC
Opera curCSS bug
Reported by: | luke.lutman@gmail.co | 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: