Side navigation
#9874 closed bug (wontfix)
Opened July 20, 2011 07:27PM UTC
Closed July 21, 2011 03:04PM UTC
Last modified July 21, 2011 04:13PM UTC
$('selector').css('background-color') returning different values depending on the browser
Reported by: | mordy@rustybrick.com | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | css | Version: | 1.6.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
JQuery prides itself on being cross browser.
if I run
$('selector').css('background-color');
or
$('selector').css('backgroundColor');
In firefox or chrome, it returns "rgb(255,255,255)"
In IE(8 & 7), it was returning "#ffffff".
Neither is more correct, but the return value should be consistent.
Bug was first observed in version 1.4.4 and upgrading to 1.6.2 didn't fix it.
Attachments (0)
Change History (7)
Changed July 21, 2011 02:43PM UTC by comment:1
component: | unfiled → css |
---|---|
priority: | undecided → low |
resolution: | → cantfix |
status: | new → closed |
Changed July 21, 2011 02:46PM UTC by comment:2
Thats disappointing .. the whole point of using jquery is that is 100% crossbrowser, all functions return exactly the same value in every circumstance.
why cant it be fixed?
Changed July 21, 2011 03:04PM UTC by comment:3
resolution: | cantfix |
---|---|
status: | closed → reopened |
I shouldn't say cantfix. I'll say wontfix instead because the amount of code required to normalize the color value types would be significant and that's probably not something users would want us to add to jQuery. However, there are conversion libraries out there if that is needed including jQuery color.
Changed July 21, 2011 03:04PM UTC by comment:4
resolution: | → wontfix |
---|---|
status: | reopened → closed |
Changed July 21, 2011 03:11PM UTC by comment:5
Can this page http://api.jquery.com/css/ be changed to reflect that there is this crossbrowseer issue.
Changed July 21, 2011 04:02PM UTC by comment:6
I don't think the issue is common enough to warrant an addition to the documentation of the css method. Whether hex or rgb, it is still a usable value so the issue is only when comparing the returned background-color to a string, which I imagine would be very rare.
Changed July 21, 2011 04:13PM UTC by comment:7
Oh well, I just added a sentence to the effect and the post collided with timmywil's comment.
I don't think there's anything we can do unless we want to include a color converter in jQuery.