blob: 078557917c812c4736ca949f6cb6ad533d8a8185 (
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
29
30
31
32
33
|
// ### This module accounts for the main svg document
//
SVG.Doc = function Doc(element) {
this.constructor.call(this, SVG.create('svg'));
/* create an extra wrapper */
var wrapper = document.createElement('div');
wrapper.style.cssText = 'position:relative;width:100%;height:100%;';
/* ensure the presence of a html element */
if (typeof element == 'string')
element = document.getElementById(element);
/* set svg element attributes and create the <defs> node */
this.
attr({ xmlns: SVG.ns, version: '1.1', width: '100%', height: '100%' }).
attr('xlink', SVG.xlink, SVG.ns).
defs();
/* add elements */
element.appendChild(wrapper);
wrapper.appendChild(this.node);
/* ensure correct rendering for safari */
this.stage();
};
// Inherits from SVG.Element
SVG.Doc.prototype = new SVG.Element();
// Include the container object
SVG.extend(SVG.Doc, SVG.Container);
|