Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#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:
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.

http://jsfiddle.net/LX2H2/2/

Change History (7)

comment:1 Changed 8 years ago by timmywil

Component: unfiledcss
Priority: undecidedlow
Resolution: cantfix
Status: newclosed

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

comment:2 Changed 8 years 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 8 years ago by timmywil

Resolution: cantfix
Status: closedreopened

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 8 years ago by timmywil

Resolution: wontfix
Status: reopenedclosed

comment:5 Changed 8 years ago by mordy@…

Can this page http://api.jquery.com/css/ be changed to reflect that there is this crossbrowseer issue.

comment:6 Changed 8 years 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.

comment:7 Changed 8 years ago by dmethvin

Oh well, I just added a sentence to the effect and the post collided with timmywil's comment.

Note: See TracTickets for help on using tickets.