"I tested Snap inside an SVG document and it works just fine. At least the dev branch. After including the script do the following
var s = Snap(document.documentElement);
// do whatever you want with this
s.circle(100, 100, 50);
s.select("circle");
// etc
Reopen it if you have any particular issues."
1-Loading SVGs
2-Snap Title Tooltip
3-Snap Dragging with custom handlers
4-Snap Dragging with a plugin, taking into account currentmatrix
5-Snap Drag and Scale
6-Using a Mask in Snap
7-Snap transforms on grouped groups
8-Loading SVG
9-Drawing path, translating and testing points inside
10-Translating a group
11-Animate dash-offset Test
12-Click Handler starting animation
13-Parse SVG Fragment
14-Basic Testing parsing some html foreignobject type stuff
15-Snap Matrix
16-Playing with sliders and knobs
17-Conversion of Raphaels Graffle
18-Snap Free Transform Plugin,..
And some of the areas where it works fine is:
1-animate numbers
2-text announce
3-text slow type
4-Snap/SVG TextPaths
5-Creating a plugin
6-Snap transforms
7-Snap embed an SVG image
8-Stroke Dasharray messing
Any ideas how to work around this issue if you want everything to be in an svg file?
var i = glob.doc.getElementsByTagName("head")[0] in toHex
where i is not getting defined. If someone could confirm if this isn't just me, and I'm doing this right (to their understanding) it would be useful.
<?xml version="1.0" encoding="utf-8"?> <svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" id="mysvg"> <script type="application/ecmascript" xlink:href="snap.dev.svg.js"></script>
<script type="application/ecmascript"> <![CDATA[
var s = Snap( "#mysvg" );
console.log('debug1', s); var bigC = s.circle(100,100,75); console.log('debug2', s, bigC); bigC.attr({ fill: "blue" });
console.log('debug3', s);
]]> </script> </svg>
1-Loading SVG- Failed to set the 'innerHTML' property on 'Element': The provided markup is invalid XML, and therefore cannot be inserted into an XML document.
snap.svg.js:3069
2-Snap Title Tooltip- no error message!
3-Loading SVG and animate- Cannot read property 'group' of null
4-Animate dash-offset Test- Cannot set property 'fill' of null
snap.svg.js:3307
5-Parse SVG Fragment- Failed to set the 'innerHTML' property on 'Element': The provided markup is invalid XML, and therefore cannot be inserted into an XML document.
snap.svg.js:3069
6-Basic Testing parsing some html foreignobject type stuff- no error message!
7-Playing with sliders and knobs- Cannot read property 'rect' of null
circleanim.svg:369
8-Conversion of Raphaels Graffle- Cannot read property 'ellipse' of null
circleanim.svg:211
9-Snap Free Transform Plugin- Failed to set the 'innerHTML' property on 'Element': The provided markup is invalid XML, and therefore cannot be inserted into an XML document.
snap.svg.js:3069
10-Snap matrix, drag, animate on loaded object- undefined is not a function
snap.svg.js:1640