diff options
author | wout <wout@impinc.co.uk> | 2014-02-03 15:14:47 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2014-02-03 15:14:47 +0100 |
commit | e2304534e0cfb6f6f4ab8c37ea5275ae26cd455a (patch) | |
tree | 2386e9f361d9c5fa1308387aeeaf33f00241b3c5 /src/use.js | |
parent | 7a29817ffd764cf7ab6906250b57f234801c94e0 (diff) | |
download | svg.js-e2304534e0cfb6f6f4ab8c37ea5275ae26cd455a.tar.gz svg.js-e2304534e0cfb6f6f4ab8c37ea5275ae26cd455a.zip |
Implemented SVG.invent function and bumped to v1.0rc3
Diffstat (limited to 'src/use.js')
-rwxr-xr-x | src/use.js | 41 |
1 files changed, 20 insertions, 21 deletions
@@ -1,28 +1,27 @@ -SVG.Use = function() { - this.constructor.call(this, SVG.create('use')) -} +SVG.Use = SVG.invent({ + // Initialize node + create: 'use' -// Inherit from SVG.Shape -SVG.Use.prototype = new SVG.Shape + // Inherit from +, inherit: SVG.Shape -// -SVG.extend(SVG.Use, { - // Use element as a reference - element: function(element) { - /* store target element */ - this.target = element + // Add class methods +, extend: { + // Use element as a reference + element: function(element) { + /* store target element */ + this.target = element - /* set lined element */ - return this.attr('href', '#' + element, SVG.xlink) + /* set lined element */ + return this.attr('href', '#' + element, SVG.xlink) + } } -}) - -// -SVG.extend(SVG.Container, { - // Create a use element - use: function(element) { - return this.put(new SVG.Use).element(element) + // Add parent method +, construct: { + // Create a use element + use: function(element) { + return this.put(new SVG.Use).element(element) + } } - })
\ No newline at end of file |