Switch to handling SVG tagNames case-insensitively across the whole codebase.

Since Node's jsdom doesn't provide case-sensitive tagNames.
This commit is contained in:
Jürg Lehni 2013-05-09 01:45:38 -07:00
parent 0174f7e2e5
commit 8cd57743c8

View file

@ -68,7 +68,7 @@ new function() {
function importGroup(node, type) { function importGroup(node, type) {
var nodes = node.childNodes, var nodes = node.childNodes,
clip = type === 'clipPath', clip = type === 'clippath',
item = clip ? new CompoundPath() : new Group(), item = clip ? new CompoundPath() : new Group(),
project = item._project, project = item._project,
currentStyle = project._currentStyle; currentStyle = project._currentStyle;
@ -142,7 +142,7 @@ new function() {
if (child.nodeType == 1) if (child.nodeType == 1)
stops.push(applyAttributes(new GradientStop(), child)); stops.push(applyAttributes(new GradientStop(), child));
} }
var isRadial = type === 'radialGradient', var isRadial = type === 'radialgradient',
gradient = new Gradient(stops, isRadial), gradient = new Gradient(stops, isRadial),
origin, destination, highlight; origin, destination, highlight;
if (isRadial) { if (isRadial) {
@ -160,12 +160,14 @@ new function() {
return null; return null;
} }
// NOTE: All importers are lowercase, since jsdom is using uppercase
// nodeNames still.
var importers = { var importers = {
// http://www.w3.org/TR/SVG/struct.html#Groups // http://www.w3.org/TR/SVG/struct.html#Groups
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
@ -173,9 +175,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) {