diff options
Diffstat (limited to 'src/instance.js')
-rw-r--r-- | src/instance.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/instance.js b/src/instance.js new file mode 100644 index 0000000..086a019 --- /dev/null +++ b/src/instance.js @@ -0,0 +1,28 @@ +SVG.Use = function() { + this.constructor.call(this, SVG.create('use')) +} + +// Inherit from SVG.Shape +SVG.Use.prototype = new SVG.Element + +// +SVG.extend(SVG.Use, { + + // (re)load image + load: function(url) { + return (url ? this.attr('xlink:href', (this.src = url), SVG.xlink) : this) + } + +}) + +// +SVG.extend(SVG.Container, { + // Create a use element + use: function(element) { + if (element instanceof SVG.Element) + element = element.id + + return this.put(new SVG.Use().) + } + +})
\ No newline at end of file |