Snap.svg icon indicating copy to clipboard operation
Snap.svg copied to clipboard

Issue snap 0.5 build: 2017-02-06 Elem.attr("fill")

Open pfx81 opened this issue 8 years ago • 11 comments

I get this new error with the following code (with snap.svg.js 0.5 build: 2017-02-06):

`var s = Snap("#svg1"); var r = s.rect(100,100,100,100).attr({ stroke: '#123456', 'strokeWidth': 20, fill: 'red', 'opacity': 1 });

console.log(r.attr("fill"));

Uncaught DOMException: Failed to execute 'querySelector' on 'Document': 'rgb(255, 0, 0)' is not a valid selector. at Snap (http://127.0.0.1:38233/test-snap-0.5/code/snap.svg.js:901:30) at Element. (http://127.0.0.1:38233/test-snap-0.5/code/snap.svg.js:4516:16) at eve (http://127.0.0.1:38233/test-snap-0.5/code/snap.svg.js:111:28) at Element.attr (http://127.0.0.1:38233/test-snap-0.5/code/snap.svg.js:2280:24) at http://127.0.0.1:38233/test-snap-0.5/code/app.js:4:15 Snap @ snap.svg.js:901 (anonymous) @ snap.svg.js:4516 eve @ snap.svg.js:111 Element.attr @ snap.svg.js:2280 (anonymous) @ app.js:4`

Can someone confirm?

thank you

pfx81 avatar Feb 06 '17 11:02 pfx81

Is this with v0.5.1?

ThomasBrierley avatar Feb 06 '17 11:02 ThomasBrierley

Fixed in 0.5.1

DmitryBaranovskiy avatar Feb 06 '17 11:02 DmitryBaranovskiy

I am still having this issue and am using version 0.5.1. I am trying to animate a fill from a path using the following code el.animate({'fill': 'red'},1000);

cavanbecksmith avatar Apr 20 '17 13:04 cavanbecksmith

Can confirm this http://jsfiddle.net/qywLcpqe/

ibrierley avatar Apr 20 '17 14:04 ibrierley

Hmm that's using 0.5.0 from a cdn, just double checking

ibrierley avatar Apr 20 '17 14:04 ibrierley

I note https://github.com/adobe-webplatform/Snap.svg/blob/master/dist/snap.svg.js has 0.5.1 written at the top, but 0.5.0 lower down for Eve and version. The cdn at https://cdnjs.cloudflare.com/ajax/libs/snap.svg/0.5.1/snap.svg.js for example for 0.5.1 says 0.5.0 at the top and lower down, so it looks a bit confusing.

Not sure if that's correct, as I'm not so familiar with that side of things, but thought I would mention it in case.

ibrierley avatar Apr 20 '17 14:04 ibrierley

Thanks a million 👍 ! I was using the cdn link in my code and have just downloaded the latest distribution and works perfectly!

cavanbecksmith avatar Apr 20 '17 14:04 cavanbecksmith

That's great. Missing piece of the puzzle for me, is how CDNs get their files in the first place.

ibrierley avatar Apr 20 '17 14:04 ibrierley

it still happening ... in version 0.5.1 . how can i animate my fill color in svg?

guirenpei avatar Jan 17 '18 03:01 guirenpei

You could probably build the fill manually, and use the Snap.animate( from, to, function, duration, callback) method and use rgb() as an interim measure

Something like..

Snap.animate( [10,10,10],[20,30,40], function( val ) { el.attr('fill', 'rgb('+val[0]+','+val[1]+','+val[2]+')') }, 2000 );

On Wed, Jan 17, 2018 at 3:29 AM, guirenpei [email protected] wrote:

it still happening ... in version 0.5.1 . how can i animate my fill color in svg?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/adobe-webplatform/Snap.svg/issues/504#issuecomment-358186354, or mute the thread https://github.com/notifications/unsubscribe-auth/ADuG9Zz5-WK_P91u9e15xIBR8Il4F40Nks5tLWkrgaJpZM4L4EFh .

ibrierley avatar Jan 17 '18 07:01 ibrierley

Confirm resolved in 0.5.1. As above there is confusing version on CDN that has filename 0.5.1 but is actually 0.5.0.

cjgordon avatar Apr 23 '20 03:04 cjgordon