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 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 or 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);