Ticket #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: | |
| Blocking: | Blocked by: |
Description
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: 4.0.203.2.
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
comment:2 Changed 4 years ago by pbuyle
I've the same issue with Google Chrome 4.0.213.1 on Linux but not with Chrome 3.0.195.24 on Windows.
comment:3 Changed 4 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 4 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 4 years ago by john
- Status changed from new to closed
- Version changed from 1.3.2 to 1.4a1
- Resolution set to fixed
comment:7 Changed 21 months ago by rwaldron
- Status changed from closed to reopened
- Resolution fixed deleted
- Milestone 1.4 deleted
comment:8 Changed 21 months ago by rwaldron
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 ),
comment:9 Changed 21 months ago by dmethvin
- Priority changed from major to high
- Status changed from reopened to open
- Milestone set to 1.7
comment:10 Changed 21 months ago by timmywil
- Owner set to timmywil
- Status changed from open to assigned
comment:11 Changed 21 months ago by timmywil
- Status changed from assigned to closed
- Resolution set to fixed
Leave the opacity test unanchored in case of floating point rounding browser errors; small fix in queue tests. Fixes #5145.
Changeset: a18645c6f8f5d8d84c4d47c7137683ac7b4098cc
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

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