Bug Tracker

Modify

Ticket #9874 (closed bug: wontfix)

Opened 22 months ago

Last modified 22 months ago

$('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.

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

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

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

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.

comment:7 Changed 22 months ago by dmethvin

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.