aboutsummaryrefslogtreecommitdiffstats
path: root/src/instance.js
blob: 086a01965088459fd1622136275282f98618667f (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.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().)
  }

})