From 01e08e2116b95b70d411b83b9fa35342a012393a Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Thu, 10 Feb 2011 19:09:35 +0000 Subject: [PATCH] Fixed bugs causing tests to fail in Firefox and IE9 git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1993 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/draw.js | 7 +++++-- editor/history.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/editor/draw.js b/editor/draw.js index f3152633..8db3138b 100644 --- a/editor/draw.js +++ b/editor/draw.js @@ -23,6 +23,9 @@ var svg_ns = "http://www.w3.org/2000/svg"; var se_ns = "http://svg-edit.googlecode.com"; var xmlns_ns = "http://www.w3.org/2000/xmlns/"; +var visElems = 'a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use'; +var visElems_arr = visElems.split(','); + var RandomizeModes = { LET_DOCUMENT_DECIDE: 0, ALWAYS_RANDOMIZE: 1, @@ -375,8 +378,8 @@ svgedit.draw.Drawing.prototype.identifyLayers = function() { orphans.push(child); } } - // if child has a bbox (i.e. not a or <defs> element), then it is an orphan - else if(svgedit.utilities.getBBox(child) && child.nodeName != 'defs') { // Opera returns a BBox for defs + // if child has is "visible" (i.e. not a <title> or <defs> element), then it is an orphan + else if(~visElems_arr.indexOf(child.nodeName)) { var bb = svgedit.utilities.getBBox(child); orphans.push(child); } diff --git a/editor/history.js b/editor/history.js index d5edda2e..47678768 100644 --- a/editor/history.js +++ b/editor/history.js @@ -224,7 +224,7 @@ svgedit.history.RemoveElementCommand.prototype.unapply = function(handler) { svgedit.transformlist.removeElementFromListMap(this.elem); if(this.nextSibling == null) { - console.log('Error: reference element was lost'); + if(window.console) console.log('Error: reference element was lost'); } this.parent.insertBefore(this.elem, this.nextSibling);