1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-17 23:34:50 +00:00

Firefox fix

Was preventing zoomin animations working properly
This commit is contained in:
Jeremy Ruston 2012-07-07 18:44:27 +01:00
parent c49c4ef681
commit 9c7a6e5973

View File

@ -89,10 +89,19 @@ Node.prototype.getNodeBounds = function() {
var t,bounds; var t,bounds;
if(this.domNode) { if(this.domNode) {
if(this.domNode.nodeType === 3) { // Node.TEXT_NODE if(this.domNode.nodeType === 3) { // Node.TEXT_NODE
return this.domNode.parentNode.getBoundingClientRect(); bounds = this.domNode.parentNode.getBoundingClientRect();
} else { } else {
return this.domNode.getBoundingClientRect(); bounds = this.domNode.getBoundingClientRect();
} }
// Absurdly, Firefox requires us to do this, otherwise JSON.stringify() gets confused
return {
top: bounds.top,
left: bounds.left,
right: bounds.right,
bottom: bounds.bottom,
width: bounds.width,
height: bounds.height
};
} else { } else {
if(this.child) { if(this.child) {
return this.child.getNodeBounds(); return this.child.getNodeBounds();