diff options
author | wout <wout@impinc.co.uk> | 2013-02-20 19:10:03 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2013-02-20 19:10:03 +0100 |
commit | ae878fd63077d4c95f2de9053a6f0951b55239eb (patch) | |
tree | 5dba7bd42a8b5702faeb6cc12d2b4d4099841e51 /src/doc.js | |
parent | 5020240e4029a61a9620f21d7be4d9764e7723d1 (diff) | |
download | svg.js-ae878fd63077d4c95f2de9053a6f0951b55239eb.tar.gz svg.js-ae878fd63077d4c95f2de9053a6f0951b55239eb.zip |
Created separate classes for SVG.ViewBox anSVG.BBox0.6
Diffstat (limited to 'src/doc.js')
-rw-r--r-- | src/doc.js | 42 |
1 files changed, 21 insertions, 21 deletions
@@ -1,26 +1,26 @@ // ### This module accounts for the main svg document // -SVG.Doc = function Doc(element) { - this.constructor.call(this, SVG.create('svg')); +SVG.Doc = function(element) { + this.constructor.call(this, SVG.create('svg')) /* ensure the presence of a html element */ this.parent = typeof element == 'string' ? document.getElementById(element) : - element; + 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(); + defs() /* ensure correct rendering for safari */ this.stage(); -}; +} // Inherits from SVG.Container -SVG.Doc.prototype = new SVG.Container(); +SVG.Doc.prototype = new SVG.Container // Hack for safari preventing text to be rendered in one line. // Basically it sets the position of the svg node to absolute @@ -28,35 +28,35 @@ SVG.Doc.prototype = new SVG.Container(); SVG.Doc.prototype.stage = function() { var check, element = this, - wrapper = document.createElement('div'); + wrapper = document.createElement('div') /* set temp wrapper to position relative */ - wrapper.style.cssText = 'position:relative;height:100%;'; + wrapper.style.cssText = 'position:relative;height:100%;' /* put element into wrapper */ - element.parent.appendChild(wrapper); - wrapper.appendChild(element.node); + element.parent.appendChild(wrapper) + wrapper.appendChild(element.node) /* check for dom:ready */ check = function() { if (document.readyState === 'complete') { - element.attr('style', 'position:absolute;'); + element.attr('style', 'position:absolute;') setTimeout(function() { /* set position back to relative */ - element.attr('style', 'position:relative;'); + element.attr('style', 'position:relative;') /* remove temp wrapper */ - element.parent.removeChild(element.node.parentNode); - element.node.parentNode.removeChild(element.node); - element.parent.appendChild(element.node); + element.parent.removeChild(element.node.parentNode) + element.node.parentNode.removeChild(element.node) + element.parent.appendChild(element.node) - }, 5); + }, 5) } else { - setTimeout(check, 10); + setTimeout(check, 10) } - }; + } - check(); + check() - return this; -};
\ No newline at end of file + return this +}
\ No newline at end of file |