My work involves working with huge svg documents (up to 500k Dom nodes) with a relatively well defined structure so there are lots of bits of svg that I'm less familiar with. Because I'm fairly sensitive to performance issues I've seen the work that goes on there and you're right, it's second class compared to html but there's still development happening.
The layout management is definitely substandard. It's a bit of a kludge but you can use foreignobject to put HTML inside svg and do the layout there. On paper it doesn't look too bad [0] but YMMV and I haven't played with it myself.
All in all I'd like to see more activity in the svg space. It's a great tool and with a bit more awareness I think it could have a great future in the web development world.
Performance is good! I've definitely had to come up with some pretty clever hacks but it feels smooth once the SVG has loaded. In our case we need to be able to zoom in to arbitrary levels and still have crisp vectors.
Here's an example of a document with about 150,000 dom nodes. You'll see that it's a little sluggish when you're zooming in and out but after it catches up it's really quick to move around. Most of our documents are much smaller than this so there's no real delay on zoom in those cases.
https://dl.dropboxusercontent.com/u/233998/example_movement....
Generally speaking when you have that many elements, you've surpassed the threshold of what SVG is intended to do. Canvas can be a seamless replacement for SVG without any tradeoffs, other than additional build complexity
Yeah, the machine is definitely going to make a difference, though as I say a) most our documents are smaller than this and b) we have ways of speeding up bigger documents where required.
Sure, SVG isn't made for this, but it works. Going to canvas would mean a load of extra work and you can be sure there would be other tradeoffs and issues to work around. Additionally, SVG is super hackable. You can work with it easily front and back end. You can read it and understand what's going on.
And hey, if your users are happy.... :-)
http://www.capterra.com/takeoff-software/spotlight/144811/Co...
Given that svg 100% works for my usecase, I don't have any reason to attempt anything else at the moment. People give svg a hard time about performance and I think that's counterproductive. My suggestion is that everyone should give it more of an honest shot and I suspect they'll find that there are plenty of cases when it becomes the first tool they reach for.
[0] http://stackoverflow.com/questions/19284304/how-redraw-on-ca...
So unless there is excellent support (can make animations, generates nice code,..) by Adobe products it wont catch on.
What is absolutely terrible is dealing with SVGs exported from Sketch. And that's all our UX/UI/Designers use these days.
However we have used Sketch's SVG export for things like icons, and I've found it to be pretty good. There's even an CLI export tool than you can integrate into your build process.
Hackers and Painters: http://paulgraham.com/hp.html
Depends on what you mean by absolute. The current transformation matrix (CTM) in each group hierarchy is computed relative to the parent element.
But then we got a requirement to overlay a line chart on the bars. And that meant layering a separate SVG on top, and doing a bunch of script work to make sure everything lined up correctly. E.g. detecting when the window resized, or when the content overflowed, etc.
It worked, but the resulting code is not at all fun to work with. The frustrating thing is the that the layout is trivial in pure HTML + CSS, and the graphics are trivial in pure SVG. But neither has the complete story, and so you end up having to jump through so many hoops, when it feels like it could be so much easier.
Think loading times are bad on script-heavy websites now? Wait until every web app uses its own mix of graphics, font and layout libraries, all compiled from C/C++ to WebAssembly and shipped in a 100MB blob. And rendered without any integration with accessibility technologies, and with basic things like copy and paste disabled to stop you "stealing" content. No thanks.
SVG 2 leaves the "painter model" behind (where z-order is determined by document order of the respective shape within its container) in favour of the z-index CSS property, so that you can address it in CSS (eg. `:selected { z-index: 1 }`). This makes it possible to describe things like interactive maps and DVD-like menus where when you click on a shape, the shape gets scaled or applied some other transform for highlighting.
However, I agree that SVG 2 leaves a bit to be desired (for example, level of detail properties). Also, animation of SVG in FF sucks compared to Chrome and Safari, or at least it used to 3 years ago. I wanted to teach my 12-year old how to make a simple browser game, but had to resort to hackish workarounds to make it run smoothly on top of using rAF etc., ruining my pedagogical ambitions.
I can relate to this, I use to work on a svg-heavy project in 2014 and I had the same kind of issues and I filed many bugs on FF bug tracker .
Fortunately, they've all been fixed by the mid of 2015. I don't work with svg so I don't know if everything works well now, but at least there were improvements.
CSS/SVG is used for websites.
Time will tell though.
- Poor optimisation. Browsers have done a lot to speed up HTML + CSS rendering via the GPU, and you can you use WebGL to make canvas fast. SVG seems to have been neglected in comparison.
- No layout management. HTML + CSS isn't perfect in this regard, but you still get blocks + inline text, floats, absolute positioning, tables and flexbox (and soon, grids). In SVG, you get absolute positioning, and that's it. If you want to do any kind of complex layout, you have to calculate everything yourself in script.
I'm not sure the major browser vendors really care too much about SVG. Compare the huge advances made in other areas of the web platform with the years-long, incredibly unambitious SVG 2 specification process.
It's a real shame as as this presentation shows, you can do some incredible stuff with SVG. But it could be so much more if there was just a bit more effort invested.