An extension to the Raphael Vector Library.
It enables Raphael to import raw SVG data.
This is a fork of raphael.svg-import. When the original raphael-svg-import reached 0.0.3, a major backwards-incompatible change was introduced. Instead of parsing SVG documents, it used regular expressions. This was undesirable for several reasons:
<g>) are lost.
See demo.html for the full example. Use AJAX to retrieve your SVG file as an XML document. Then use importSVG() to convert the SVG into a raphael.js set:
If you want the Raphael paper dimensions to automatically match the SVG:
If you want to import the SVG from an element within the page you can access to the element:
And you can access to the svg element by its id:
var paper = ;var newSet = paper;
In the assets folder a demo.svg file is provided.
Nothing fancy but it gives you a starting point.
tests/qunit.html in your targeted browers. A command line
version can be run based on webkit with
grunt qunit. A hosted version can be
tests/visual_tests.html in your targeted browsers.
A hosted version can be found here.
Follow the same instructions as above IE. When looking at the Qunit test in IE, all tests will fail, but the output should look the same as other browsers.
$ grunt testRunning "jshint:all" (jshint) task>> 2 files lint free.Running "qunit:all" (qunit) taskTesting tests/qunit.html .............OK>> 20 assertions passed (57ms)Done, without errors
Copyright (c) 2015 Chris Chang Original Raphael SVG Import Copyright (c) 2009 Wout Fierens See LICENSE.txt for further details.
I've tried keeping all the files as close to the original as possible. So there are lots of files not relevant to this fork in the tree.
There is a bug in the minified version of of Raphael.js that most people use. It's best to just grab the uncompressed source and minify it yourself.