Ticket #9874 (closed bug: wontfix)
$('selector').css('background-color') returning different values depending on the browser
| Reported by: | mordy@… | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | css | Version: | 1.6.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
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.
Change History
comment:1 Changed 22 months ago by timmywil
- Priority changed from undecided to low
- Resolution set to cantfix
- Status changed from new to closed
- Component changed from unfiled to css
comment:2 Changed 22 months ago by mordy@…
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?
comment:3 Changed 22 months ago by timmywil
- Status changed from closed to reopened
- Resolution cantfix deleted
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.
comment:4 Changed 22 months ago by timmywil
- Status changed from reopened to closed
- Resolution set to wontfix
comment:5 Changed 22 months ago by mordy@…
Can this page http://api.jquery.com/css/ be changed to reflect that there is this crossbrowseer issue.
comment:6 Changed 22 months ago by timmywil
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.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

I don't think there's anything we can do unless we want to include a color converter in jQuery.