From 92eb89fc435fc9415a688cadb04ce0d028507f3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 10 Nov 2012 15:48:15 -0800 Subject: [PATCH] Clean up and shorten code. --- src/svg/SvgImport.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/svg/SvgImport.js b/src/svg/SvgImport.js index 15612062..9aa5b748 100644 --- a/src/svg/SvgImport.js +++ b/src/svg/SvgImport.js @@ -239,8 +239,11 @@ new function() { origin = getPoint(svg, 'x1', 'y1'); destination = getPoint(svg, 'x2', 'y2'); } - var gradientColor = new GradientColor(gradient, origin, destination, highlight); - applyAttributes(gradientColor, svg); + // We don't return the GradientColor, since we only need a reference to + // it in definitions, which is created in applyAttributes() + applyAttributes( + new GradientColor(gradient, origin, destination, highlight), svg); + return null; } var definitions = {}; @@ -268,9 +271,7 @@ new function() { // http://www.w3.org/TR/SVG/struct.html#SymbolElement symbol: function(svg, type) { - var item = importGroup(svg, type); - item = applyAttributes(item, svg); - return new Symbol(item); + return new Symbol(applyAttributes(importGroup(svg, type), svg)); }, // http://www.w3.org/TR/SVG/struct.html#DefsElement @@ -332,7 +333,7 @@ new function() { // lengthAdjust: var text = new PointText(getPoint(svg, 'x', 'y', false, 0) .add(getPoint(svg, 'dx', 'dy', false, 0))); - text.content = svg.textContent || ''; + text.setContent(svg.textContent || ''); return text; } };