Search and Top Navigation
#6910 closed bug (fixed)
Opened January 28, 2011 07:18PM UTC
Closed June 25, 2012 11:27PM UTC
Trying to animate the background color of a document fragment can easily fail
Reported by: | dwt | Owned by: | gnarf |
---|---|---|---|
Priority: | minor | Milestone: | 1.9.0 |
Component: | ui.effects.* (individual effect) | Version: | 1.8.8 |
Keywords: | color | Cc: | |
Blocked by: | Blocking: |
Description
I discovered this as I wanted to run unit-tests on document-fragments to avoid having the browser trying to actually render them. (For speed).
The problem is that the method getColor (in the effects package) will return undefined as / if the document fragment root does no color.
Bad bad library. :)
Here's the problematic code
function getColor(elem, attr) {
var color;
do {
color = $.curCSS(elem, attr);
// Keep going until we find an element that has color, or we hit the body
if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
break;
attr = "backgroundColor";
} while ( elem = elem.parentNode );
return getRGB(color);
};
I think that this needs another check which defaults to 'transparent' if no color cold be found (or otherwise defaults to something that is valid for that browser).
Attachments (0)
Change History (5)
Changed January 28, 2011 07:19PM UTC by comment:1
Changed March 28, 2011 05:58PM UTC by comment:2
status: | new → open |
---|
Changed April 27, 2011 09:21PM UTC by comment:3
owner: | → gnarf |
---|---|
status: | open → assigned |
The rewrite of jquery.color is going to fix this.
Changed May 13, 2011 05:16PM UTC by comment:4
keywords: | → color |
---|
Changed June 25, 2012 11:27PM UTC by comment:5
resolution: | → fixed |
---|---|
status: | assigned → closed |
Upgrade to jquery-color 2.0pre. Fixes #6910 - Trying to animate the background color of a document fragment can easily fail. Fixes #5215 - Effects color: Add support for rgba animations. Fixes #4372 - Animate backgroundColor to 'transparent'. Fixes #5393 - getColor reports inaccurate color for transparent elements in Webkit. Fixes #3806 - Feature request: expose getRGB and getColor.
Changeset: 13d560b8f05a8eedbf28851824fe639a254f9fd0
well, maybe white is a better default.