summaryrefslogtreecommitdiffstats
path: root/src/container.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2012-12-23 11:52:07 +0100
committerwout <wout@impinc.co.uk>2012-12-23 11:52:07 +0100
commit1ae730fec364f70d4541f38930929607dc2a31ac (patch)
tree16630efcc4b3ce6a09454681141518a05e4acde4 /src/container.js
parent70394584bec59f0b01998b9b54479bb913b0b32a (diff)
downloadsvg.js-1ae730fec364f70d4541f38930929607dc2a31ac.tar.gz
svg.js-1ae730fec364f70d4541f38930929607dc2a31ac.zip
Fixed a bug in safari prevending correct dy on tspans
Diffstat (limited to 'src/container.js')
-rw-r--r--src/container.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/container.js b/src/container.js
index f45bd6c..c5658ee 100644
--- a/src/container.js
+++ b/src/container.js
@@ -44,7 +44,7 @@ SVG.Container = {
return this._defs;
},
- levelDefs: function() {
+ level: function() {
var d = this.defs();
this.remove(d).add(d, 0);
@@ -103,6 +103,28 @@ SVG.Container = {
gradient: function(t, b) {
return this.defs().gradient(t, b);
+ },
+
+ // hack for safari preventing text to be rendered in one line,
+ // basically it sets the position of the svg node to absolute
+ // when the dom is loaded, and resets it to relative a few ms later.
+ stage: function() {
+ if (document.readyState !== 'complete') {
+ var r, e = this;
+
+ r = function() {
+ if (document.readyState === 'complete') {
+ e.node.style.position = 'absolute';
+ setTimeout(function() { e.node.style.position = 'relative'; }, 5);
+ } else {
+ setTimeout(r, 10);
+ }
+ };
+
+ r();
+ }
+
+ return this;
}
}; \ No newline at end of file