diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/line.js | 10 | ||||
-rw-r--r-- | src/path.js | 2 | ||||
-rw-r--r-- | src/poly.js | 4 | ||||
-rw-r--r-- | src/textpath.js | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/src/line.js b/src/line.js index 46ee028..9e8692f 100644 --- a/src/line.js +++ b/src/line.js @@ -41,12 +41,12 @@ SVG.Line = SVG.invent({ , construct: { // Create a line element line: function(x1, y1, x2, y2) { - var line = this.put(new SVG.Line) - // make sure plot is called as a setter - return (x1 != null) ? - line.plot(x1, y1, x2, y2) : - line.plot([[0,0], [0,0]]) + // x1 is not necessarily a number, it can also be an array, a string and a SVG.PointArray + return SVG.Line.prototype.plot.apply( + this.put(new SVG.Line) + , x1 != null ? [x1, y1, x2, y2] : [0, 0, 0, 0] + ) } } }) diff --git a/src/path.js b/src/path.js index 55ac5fd..0c70a47 100644 --- a/src/path.js +++ b/src/path.js @@ -53,7 +53,7 @@ SVG.Path = SVG.invent({ // Create a wrapped path element path: function(d) { // make sure plot is called as a setter - return this.put(new SVG.Path).plot(d != null ? d : new SVG.PathArray) + return this.put(new SVG.Path).plot(d || new SVG.PathArray) } } }) diff --git a/src/poly.js b/src/poly.js index 3bd2034..af1f075 100644 --- a/src/poly.js +++ b/src/poly.js @@ -10,7 +10,7 @@ SVG.Polyline = SVG.invent({ // Create a wrapped polyline element polyline: function(p) { // make sure plot is called as a setter - return this.put(new SVG.Polyline).plot(p != null ? p : new SVG.PointArray()) + return this.put(new SVG.Polyline).plot(p || new SVG.PointArray) } } }) @@ -27,7 +27,7 @@ SVG.Polygon = SVG.invent({ // Create a wrapped polygon element polygon: function(p) { // make sure plot is called as a setter - return this.put(new SVG.Polygon).plot(p != null ? p : new SVG.PointArray()) + return this.put(new SVG.Polygon).plot(p || new SVG.PointArray) } } }) diff --git a/src/textpath.js b/src/textpath.js index e0defc3..4750310 100644 --- a/src/textpath.js +++ b/src/textpath.js @@ -32,7 +32,7 @@ SVG.TextPath = SVG.invent({ , array: function() { var track = this.track() - return (track) ? track.array() : null + return track ? track.array() : null } // Plot path if any , plot: function(d) { |