aboutsummaryrefslogtreecommitdiffstats
path: root/src/doc.js
blob: ead1116e1c4512e38b2eec7e1dacedc7781c5d11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
SVG.Doc = function Doc(e) {
  this.constructor.call(this, SVG.create('svg'));
  
  // ensure the presence of a html element
  if (typeof e == 'string')
    e = document.getElementById(e);
  
  // set 
  this.
    attr({ xmlns: SVG.ns, version: '1.1' }).
    attr('xlink', SVG.xlink, SVG.ns).
    size(e.offsetWidth, e.offsetHeight).
    defs();
  
  e.appendChild(this.node);
};

// inherit from SVG.Element
SVG.Doc.prototype = new SVG.Element();

// include the container object
SVG.extend(SVG.Doc, SVG.Container);