Bug 277324: Copy XML doesn't work on #document nodes, patch by Jason Barnabe <jason_barnabe@fastmail.fm>, r=timeless, sr=neil

This commit is contained in:
gavin%gavinsharp.com 2006-05-27 04:08:48 +00:00
Родитель 25f7b0d3b7
Коммит b66e86e580
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -360,7 +360,11 @@ DOMViewer.prototype =
toXML: function(aNode) toXML: function(aNode)
{ {
return this._toXML(aNode, 0); // we'll use XML serializer, if available
if (typeof XMLSerializer != "undefined")
return (new XMLSerializer()).serializeToString(aNode);
else
return this._toXML(aNode, 0);
}, },
// not the most complete serialization ever conceived, but it'll do for now // not the most complete serialization ever conceived, but it'll do for now
@ -405,6 +409,8 @@ DOMViewer.prototype =
s += InsUtil.unicodeToEntity(aNode.data); s += InsUtil.unicodeToEntity(aNode.data);
} else if (aNode.nodeType == Node.COMMENT_NODE) { } else if (aNode.nodeType == Node.COMMENT_NODE) {
s += line + "<!--" + InsUtil.unicodeToEntity(aNode.data) + "-->\n"; s += line + "<!--" + InsUtil.unicodeToEntity(aNode.data) + "-->\n";
} else if (aNode.nodeType == Node.DOCUMENT_NODE) {
s += this._toXML(aNode.documentElement);
} }
return s; return s;