aboutsummaryrefslogtreecommitdiffstats
path: root/src/use.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-02-03 15:14:47 +0100
committerwout <wout@impinc.co.uk>2014-02-03 15:14:47 +0100
commite2304534e0cfb6f6f4ab8c37ea5275ae26cd455a (patch)
tree2386e9f361d9c5fa1308387aeeaf33f00241b3c5 /src/use.js
parent7a29817ffd764cf7ab6906250b57f234801c94e0 (diff)
downloadsvg.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-xsrc/use.js41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/use.js b/src/use.js
index 0a8bb90..2690468 100755
--- a/src/use.js
+++ b/src/use.js
@@ -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