Opened 12 years ago
Closed 11 years ago
#6910 closed bug (fixed)
Trying to animate the background color of a document fragment can easily fail
Reported by: | dwt | Owned by: | Corey Frang |
---|---|---|---|
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).
Change History (5)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Status: | new → open |
---|
comment:3 Changed 12 years ago by
Owner: | set to Corey Frang |
---|---|
Status: | open → assigned |
The rewrite of jquery.color is going to fix this.
comment:4 Changed 12 years ago by
Keywords: | color added |
---|
comment:5 Changed 11 years ago by
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.