From 9dd851e68a3241883dea7236da48d4878b1b1899 Mon Sep 17 00:00:00 2001 From: wout Date: Fri, 21 Dec 2012 19:58:49 +0100 Subject: Cross browser fixes --- src/doc.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/doc.js') diff --git a/src/doc.js b/src/doc.js index 0fe5e21..ead1116 100644 --- a/src/doc.js +++ b/src/doc.js @@ -2,15 +2,17 @@ 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(); - if (typeof e == 'string') - e = document.getElementById(e); - e.appendChild(this.node); }; -- cgit v1.2.3