diff options
author | wout <wout@impinc.co.uk> | 2013-06-27 16:36:26 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2013-06-27 16:36:26 +0100 |
commit | 8cb2aba17829e6c9de15206b891e6c878b306a7b (patch) | |
tree | 6d3c45e02e918de27e5208f7f6516f48fe62551e /src/doc.js | |
parent | 46909dc19338e649702b6ea852120af5132bc086 (diff) | |
download | svg.js-8cb2aba17829e6c9de15206b891e6c878b306a7b.tar.gz svg.js-8cb2aba17829e6c9de15206b891e6c878b306a7b.zip |
Reworked arrange module, <defs> always on top
Diffstat (limited to 'src/doc.js')
-rw-r--r-- | src/doc.js | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -12,11 +12,14 @@ SVG.Doc = function(element) { this.constructor .call(this, this.parent.nodeName == 'svg' ? this.parent : SVG.create('svg')) - /* set svg element attributes and create the <defs> node */ + /* set svg element attributes */ this .attr({ xmlns: SVG.ns, version: '1.1', width: '100%', height: '100%' }) .attr('xlink', SVG.xlink, SVG.ns) - .defs() + + /* create the <defs> node */ + this._defs = new SVG.Defs + this.node.appendChild(this._defs.node) /* ensure correct rendering */ if (this.parent.nodeName != 'svg') @@ -26,7 +29,7 @@ SVG.Doc = function(element) { // Inherits from SVG.Container SVG.Doc.prototype = new SVG.Container - +// SVG.extend(SVG.Doc, { // Hack for safari preventing text to be rendered in one line. // Basically it sets the position of the svg node to absolute @@ -76,6 +79,11 @@ SVG.extend(SVG.Doc, { return this } + // Creates and returns defs element +, defs: function() { + return this._defs + } + // Fix for possible sub-pixel offset. See: // https://bugzilla.mozilla.org/show_bug.cgi?id=608812 , fixSubPixelOffset: function() { |