SVG nodeNames are case sensitive.

This commit is contained in:
Jürg Lehni 2013-03-01 12:59:43 -08:00
parent f1fe2575a8
commit 835ca80eff
2 changed files with 8 additions and 8 deletions

View file

@ -458,7 +458,7 @@ new function() {
// We can only use node nodes as defintion containers. Have the loop // We can only use node nodes as defintion containers. Have the loop
// produce one if it's a single item of another type (when calling // produce one if it's a single item of another type (when calling
// #exportSvg() on an item rather than a whole project) // #exportSvg() on an item rather than a whole project)
var container = node.nodeName.toLowerCase() == 'svg' && node, var container = node.nodeName == 'svg' && node,
firstChild = container ? container.firstChild : node; firstChild = container ? container.firstChild : node;
for (var i in definitions.svgs) { for (var i in definitions.svgs) {
if (!container) { if (!container) {

View file

@ -68,7 +68,7 @@ new function() {
function importGroup(node, type) { function importGroup(node, type) {
var nodes = node.childNodes, var nodes = node.childNodes,
compound = type === 'clippath', compound = type === 'clipPath',
group = compound ? new CompoundPath() : new Group(), group = compound ? new CompoundPath() : new Group(),
project = group._project, project = group._project,
currentStyle = project._currentStyle; currentStyle = project._currentStyle;
@ -97,7 +97,7 @@ new function() {
} }
// Restore currentStyle // Restore currentStyle
project._currentStyle = currentStyle; project._currentStyle = currentStyle;
if (/^(defs|clippath)$/.test(type)) { if (/^(defs|clipPath)$/.test(type)) {
// I don't think we need to add defs to the DOM. But we might want // I don't think we need to add defs to the DOM. But we might want
// to use Symbols for them? // to use Symbols for them?
group.remove(); group.remove();
@ -137,7 +137,7 @@ new function() {
stops.push(applyAttributes(new GradientStop(), child)); stops.push(applyAttributes(new GradientStop(), child));
} }
var gradient = new Gradient(stops), var gradient = new Gradient(stops),
isRadial = type == 'radialgradient', isRadial = type === 'radialGradient',
origin, destination, highlight; origin, destination, highlight;
if (isRadial) { if (isRadial) {
gradient.type = 'radial'; gradient.type = 'radial';
@ -160,7 +160,7 @@ new function() {
g: importGroup, g: importGroup,
// http://www.w3.org/TR/SVG/struct.html#NewDocument // http://www.w3.org/TR/SVG/struct.html#NewDocument
svg: importGroup, svg: importGroup,
clippath: importGroup, clipPath: importGroup,
// http://www.w3.org/TR/SVG/shapes.html#PolygonElement // http://www.w3.org/TR/SVG/shapes.html#PolygonElement
polygon: importPoly, polygon: importPoly,
// http://www.w3.org/TR/SVG/shapes.html#PolylineElement // http://www.w3.org/TR/SVG/shapes.html#PolylineElement
@ -168,9 +168,9 @@ new function() {
// http://www.w3.org/TR/SVG/paths.html // http://www.w3.org/TR/SVG/paths.html
path: importPath, path: importPath,
// http://www.w3.org/TR/SVG/pservers.html#LinearGradients // http://www.w3.org/TR/SVG/pservers.html#LinearGradients
lineargradient: importGradient, linearGradient: importGradient,
// http://www.w3.org/TR/SVG/pservers.html#RadialGradients // http://www.w3.org/TR/SVG/pservers.html#RadialGradients
radialgradient: importGradient, radialGradient: importGradient,
// http://www.w3.org/TR/SVG/struct.html#ImageElement // http://www.w3.org/TR/SVG/struct.html#ImageElement
image: function (node) { image: function (node) {
@ -457,7 +457,7 @@ new function() {
} }
function importSvg(node, clearDefs) { function importSvg(node, clearDefs) {
var type = node.nodeName.toLowerCase(), var type = node.nodeName,
importer = importers[type], importer = importers[type],
item = importer && importer(node, type); item = importer && importer(node, type);
// See importGroup() for an explanation of this filtering: // See importGroup() for an explanation of this filtering: