#9874 closed bug (wontfix)
$('selector').css('background-color') returning different values depending on the browser
Reported by: | 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.
Change History (7)
comment:1 Changed 12 years ago by
Component: | unfiled → css |
---|---|
Priority: | undecided → low |
Resolution: | → cantfix |
Status: | new → closed |
comment:2 Changed 12 years ago by
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 12 years ago by
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.
comment:4 Changed 12 years ago by
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
comment:5 Changed 12 years ago by
Can this page http://api.jquery.com/css/ be changed to reflect that there is this crossbrowseer issue.
comment:6 Changed 12 years ago by
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.
comment:7 Changed 12 years ago by
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.