-1

Is Snap.svg vs HTML5 native SVG DOM API relatively the same as jQuery vs HTML5 native DOM ?

Other than cross browser differences, which I hope SVG is pretty well supported by any modern browsers (am I right?), what benefit does Snap.svg bring?

What would be the upside or downside of bypassing Snap.svg and code close to the metal with the SVG DOM API?

Henry
  • 32,689
  • 19
  • 120
  • 221
  • Any benefit to scratching your back with left hand vs right hand vs scratching post? Does it matter how you get your back scratched if no one hears it? Ummm..... can't think of any but good to learn a variety of framework as a coder. – Alvin K. Aug 23 '14 at 04:31

1 Answers1

1

Snap really just manipulates SVG under the hood and makes it easier, so in that sense it is similar. You don't have to fiddle with markup or any of that stuff.

The Animation it uses however isn't SVG, so you can't really export Snap Animations as SVG animation markup, which in some cases may be important, but I think most of the rest is basically SVG that can be manipulated.

Snap is relatively well supported by modern browsers. If you need older backwards compatibility, you may want to look at Raphael (same author), but then there is a trade-off where you can't use things like proper SVG groups (it uses sets/arrays which aren't SVG).

The downside of not using a library like Snap is that you get bogged down on markup errors, namespaces, write lots more code to do the same thing. The upside is you get to understand SVG properly, you don't need to rely on an external library. Snap you can do animations, make things look nice pretty fast, often in one liners. Its really difficult in pure markup along once things start to get a little tricky like transformations, manipulating paths etc.

Even if you go down to pure SVG there is still fiddly things like browser inconcistencies, so you also need to figure support relating to that as well.

Lastly I would say that some mobile SVG performance (mainly things like animation/filters etc), isn't that great, so if that is a requirement, I would have a think about if thats the correct solution, and try and do some initial tests.

Ian
  • 13,724
  • 4
  • 52
  • 75
  • Do you have any source or more info, tests etc on mobile SVG performance? – Bell Sep 18 '14 at 20:23
  • No, I would say that mobile performance of SVG is quite hit and miss with any SVG whatever (I'm partly referring to animations and things like matrices, if its just simple SVG it may be fine), depending on which mobile browser, spec of the device, animation, transforms etc. If you know your target devices, I would find some SVG already out there in a similar scope, and see how that performs on the different devices. – Ian Sep 18 '14 at 20:38