DmitryBaranovskiy/raphael — Issue #487: once the fill is set to a image url, it doesn't get removed if the fill is set to a colour later on
Author: shantanubhadoria
Created: 2011-12-30 04:39:49+00:00
State: open

Once a elements fill attribute is set to a image url as shown below :

el.attr({fill:"url('/abc.png')"});

the following statement next should set the fill to color #FF0000 and remove the image fill for the element:

el.attr({fill:"#FF0000"});

instead it ignores the new fill style and keeps the image as the fill for the element :

I have fixed the issue in raphael 2.0.1 in my setup and I am providing the patch below. its a simple one line fix.

--- a/js/raphael.js
+++ b/js/raphael.js
@@ -3890,6 +3890,7 @@ window.Raphael.svg && function (R) {
if (!clr.error) {
delete params.gradient;
delete attrs.gradient;
+ node.style.fill = "";
!R.is(attrs.opacity, "undefined") &&
R.is(params.opacity, "undefined") &&
$(node, {opacity: attrs.opacity});