Opened 11 years ago

Closed 8 years ago

#8608 closed defect (wontfix)

innerXML serializes outer node in some cases

Reported by: Adam Peller Owned by: Tom Trenka
Priority: high Milestone: future
Component: Dojox Version: 1.2.3
Keywords: Cc:
Blocked By: Blocking:

Description

dojox.xml.parser.innerXML - the first case "innerXML" ought to be just fine when available. The ".xml" case, I think, will serialize the outer node on IE, and XMLSerializer.serializeToString also serializes the outer node.

I ended up doing something like this

	var outerXML = function(/*Node*/node){
		if(node.nodeType == 3 || node.nodeType == 4)		// CDATA
			return node.nodeValue;
		if(node.xml)
			return node.xml;
		if(typeof XMLSerializer != "undefined")
			return new XMLSerializer().serializeToString(node); //	String
		throw "no xml serializer";
    };

	var innerXML = function(/*Node*/node){
		if(node.innerXML)
			return node.innerXML;
		var children = node.childNodes;
		var xml = "";
		if (children) {
			for (var i = 0; i < children.length; i++) {
				xml += outerXML(children.item(i));
			}
		}
		return xml;
    };

Change History (2)

comment:1 Changed 11 years ago by dante

Milestone: tbdfuture

punting, came in within last day but too late for 1.3 consideration?

comment:2 Changed 8 years ago by Tom Trenka

Resolution: wontfix
Status: newclosed

Going to close this ticket, as I think most of dojox.xml will be dropped for 2.0 (everything there with the exception of the DomParser? was contributed as DojoE and I have no idea if that's ever been supported once it was committed).

Note: See TracTickets for help on using tickets.