diff options
author | wout <wout@impinc.co.uk> | 2012-12-17 16:55:16 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2012-12-17 16:55:16 +0100 |
commit | 6a013f19d6fa84e538d31bca5f1466c5f3479630 (patch) | |
tree | 3807acc4240bb1dbd5f25406b262a240351fa67a /src/image.js | |
parent | 9ba8a780e0da4de4839df119f1d57d7f6327b1c6 (diff) | |
download | svg.js-6a013f19d6fa84e538d31bca5f1466c5f3479630.tar.gz svg.js-6a013f19d6fa84e538d31bca5f1466c5f3479630.zip |
Refactored code for readability and size
Diffstat (limited to 'src/image.js')
-rw-r--r-- | src/image.js | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/image.js b/src/image.js index 3c60f2a..bc1dc60 100644 --- a/src/image.js +++ b/src/image.js @@ -1,16 +1,21 @@ SVG.Image = function Image() { - this.constructor.call(this, SVG.createElement('image')); + this.constructor.call(this, SVG.create('image')); }; // inherit from SVG.Element SVG.Image.prototype = new SVG.Element(); -// (re)load image -SVG.Image.prototype.load = function(url) { - this.setAttribute('href', url, SVG.xlink); - return this; -}; - // include the container object -SVG.Image.include(SVG.Container);
\ No newline at end of file +SVG.Utils.merge(SVG.Image, SVG.Container); + +// Add image-specific functions +SVG.Utils.merge(SVG.Image, { + + // (re)load image + load: function(u) { + this.attr('href', u, SVG.xlink); + return this; + } + +});
\ No newline at end of file |