diff options
author | wout <wout@impinc.co.uk> | 2012-12-21 21:01:03 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2012-12-21 21:01:03 +0100 |
commit | cf1bd17eebe9b6cb8fac869aeec4245a0ec66fff (patch) | |
tree | 222e58dd0bb2729b237dafd22ba7077456c2b003 /src | |
parent | 9dd851e68a3241883dea7236da48d4878b1b1899 (diff) | |
download | svg.js-cf1bd17eebe9b6cb8fac869aeec4245a0ec66fff.tar.gz svg.js-cf1bd17eebe9b6cb8fac869aeec4245a0ec66fff.zip |
Making the svg function global
Diffstat (limited to 'src')
-rw-r--r-- | src/image.js | 2 | ||||
-rw-r--r-- | src/svg.js | 2 | ||||
-rw-r--r-- | src/text.js | 13 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/image.js b/src/image.js index a1d21c0..03fa1b1 100644 --- a/src/image.js +++ b/src/image.js @@ -11,7 +11,7 @@ SVG.extend(SVG.Image, { // (re)load image load: function(u) { - return this.attr('href', u, SVG.xlink); + return this.attr('xlink:href', u, SVG.xlink); } });
\ No newline at end of file @@ -13,6 +13,6 @@ this.SVG = { } }; -this.svg = function(e) { +window.svg = function(e) { return new SVG.Doc(e); };
\ No newline at end of file diff --git a/src/text.js b/src/text.js index e102360..7528c27 100644 --- a/src/text.js +++ b/src/text.js @@ -17,7 +17,8 @@ SVG.extend(SVG.Text, { this.content = t = t || 'text'; this.lines = []; - var i, s, + var i, n, + s = this._style(), p = this.parentDoc(), a = t.split("\n"); @@ -25,19 +26,19 @@ SVG.extend(SVG.Text, { this.node.removeChild(this.node.lastChild); for (i = 0, l = a.length; i < l; i++) { - s = new TSpan(). + n = new TSpan(). text(a[i]). attr({ dy: this.style['font-size'] * this.leading, x: (this.attr('x') || 0), - style: this._style() + style: s }); - this.node.appendChild(s.node); - this.lines.push(s); + this.node.appendChild(n.node); + this.lines.push(n); }; - return this; + return this.attr('style', s); }, _style: function() { |