Bug Tracker

Opened 8 years ago

Closed 6 years ago

Last modified 5 years ago

#5145 closed bug (fixed)

jQuery.support.opacity = false in the Chrome browser

Reported by: piotrl86 Owned by: timmywil
Priority: high Milestone: 1.7
Component: support Version: 1.4a1
Keywords: opacity chrome Cc:
Blocked by: Blocking:


I found that jQuery.support.opacity = false in the Chrome browser but I think it should be true because the css property works fine for me. Tested on Linux, browser version:

I checked the source code for jQuery 1.3.2 and I found that in Chrome browser: [some HTML Element].style.opacity = "0,5" but in other browsers like Firefox: [some HTML Element].style.opacity = "0.5"

line 3159 in jquery-1.3.2.js:

opacity: a.style.opacity === "0.5",

but "0.5" is not equal to "0,5"

Cheers, Piotr Labudda

Change History (11)

comment:1 Changed 8 years ago by TiGR

Confirm it here, on Linux too. Had to create patched jquery in order to make transparency effects work in Chrome/Chromium. Just changed this line to

		opacity: a.style.opacity === "0.5" || a.style.opacity === "0,5" ,

comment:2 Changed 8 years ago by pbuyle

I've the same issue with Google Chrome on Linux but not with Chrome on Windows.

comment:3 Changed 8 years ago by Ame_Nomade

In fact it's not a bug in jQuery, it's a bug in Chrome http://code.google.com/p/chromium/issues/detail?id=22782 that comes from an old bug in Webkit https://bugs.webkit.org/show_bug.cgi?id=18994 It depends on your locale

comment:4 Changed 7 years ago by TiGR

It seems that both Chrome and WebKit bugs were fixed recently.

However, we have lots of browsers (everything webkit-based that was released at least since May 2008 till Nov 2009) that experience this issue. I think that it is a good idea to add some kind of workaround for these browsers (see above).

comment:5 Changed 7 years ago by john

Resolution: fixed
Status: newclosed

comment:6 Changed 7 years ago by john

Component: coresupport

comment:7 Changed 6 years ago by Rick Waldron

Milestone: 1.4
Resolution: fixed
Status: closedreopened

comment:8 Changed 6 years ago by Rick Waldron

From http://bugs.jquery.com/ticket/10384

I know this is a dublicate of 'Ticket #5145'. I can't reopen it :-(

My phone (a webkit clone) throws an error on FadeIn() and fadeOut(). That's because it returns 'false' for '$.support.opacity'. Then it triggers the IE only 'cssHooks.opacity' and chunks on 'style.removeAttribute'. The real problem is that when setting style.opacity to '.55' and then read it, it says: '0,550000011920929' (note the comma and the rounding error).

Now if I simply add this to my code:

        jQuery.support.opacity = true;
        jQuery.cssHooks.opacity = undefined;

everything is fine, fadeIn() works like show() and fadeOut() works like hide() - a lot better than an error.

So, basically we need to change the test for 'support.opacity', so it includes the above value, but still excludes old IE. Line 1221 currently says:

		opacity: /^0.55$/.test( a.style.opacity ),

By removing the '$' sign it should work:

		opacity: /^0.55/.test( a.style.opacity ),

Last edited 6 years ago by Rick Waldron (previous) (diff)

comment:9 Changed 6 years ago by dmethvin

Milestone: 1.7
Priority: majorhigh
Status: reopenedopen

comment:10 Changed 6 years ago by timmywil

Owner: set to timmywil
Status: openassigned

comment:11 Changed 6 years ago by timmywil

Resolution: fixed
Status: assignedclosed

Leave the opacity test unanchored in case of floating point rounding browser errors; small fix in queue tests. Fixes #5145.

Changeset: a18645c6f8f5d8d84c4d47c7137683ac7b4098cc

Note: See TracTickets for help on using tickets.