summaryrefslogtreecommitdiffstats
path: root/src/boxes.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-09-03 12:15:16 +0200
committerwout <wout@impinc.co.uk>2014-09-03 12:15:16 +0200
commit69da2d385450daa158d75ebe59449cc044ec8022 (patch)
tree94d13794806978d4a8ca4d50ac0323b7d93475b7 /src/boxes.js
parent826649995f1aae806fb9bf8464a4259c4290c4fb (diff)
downloadsvg.js-69da2d385450daa158d75ebe59449cc044ec8022.tar.gz
svg.js-69da2d385450daa158d75ebe59449cc044ec8022.zip
Firefox fixes and event specs
Diffstat (limited to 'src/boxes.js')
-rwxr-xr-xsrc/boxes.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/boxes.js b/src/boxes.js
index 2c5cd8b..0b90f60 100755
--- a/src/boxes.js
+++ b/src/boxes.js
@@ -5,17 +5,19 @@ SVG.BBox = SVG.invent({
if (element) {
var box
- // find native bbox
- if (element.node.getBBox)
+ // yes this is ugly, but Firefox can be a bitch when it comes to elements that are not yet rendered
+ try {
+ // find native bbox
box = element.node.getBBox()
- // mimic bbox
- else
+ } catch(e) {
+ // mimic bbox
box = {
x: element.node.clientLeft
, y: element.node.clientTop
, width: element.node.clientWidth
, height: element.node.clientHeight
}
+ }
// plain x and y
this.x = box.x