summaryrefslogtreecommitdiffstats
path: root/src/use.js
blob: 0a8bb90b20cf07ffe9e2e7ce19596a738d33a1a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
SVG.Use = function() {
  this.constructor.call(this, SVG.create('use'))
}

// Inherit from SVG.Shape
SVG.Use.prototype = new SVG.Shape

//
SVG.extend(SVG.Use, {
  // Use element as a reference
  element: function(element) {
    /* store target element */
    this.target = element

    /* 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)
  }

})