Closed Bug 579667 Opened 14 years ago Closed 14 years ago

img tags in xml are not serialized properly with XMLSerializer

Categories

(Core :: XML, defect)

1.9.2 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 541937

People

(Reporter: siur2, Unassigned)

Details

Attachments

(1 file)

548 bytes, text/html
Details
User-Agent:       Opera/9.80 (Windows NT 5.1; U; en) Presto/2.6.30 Version/10.60
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6

If you have in xml DOM tree an element with name "img" and it contains text node then img element will not be serialized properly after using XMLSerializer.
This problem appeared after one of recent firefox updates. As workaround I just don't use "img" elements in xml. iirc same problem is applied to "image" xml elements as well.

Reproducible: Always

Steps to Reproduce:
<html>
<head>
<script language="javascript">
	function Foo() {
		var doc = document.implementation.createDocument("", "", null);
		var root = document.createElement("root");
		doc.appendChild(root);
		var node = document.createElement("img");
		root.appendChild(node);
		node.appendChild(doc.createTextNode("Foo.png"));
		document.getElementById("iptMessage").value =
			new XMLSerializer().serializeToString(doc);
	}
</script>
</head>
<body onLoad="Foo()">
<input id="iptMessage" style="width:500"/>
</body>
</html>
Actual Results:  
<root xmlns="http://www.w3.org/1999/xhtml"><img />Foo.png</root>

Expected Results:  
<root xmlns="http://www.w3.org/1999/xhtml"><img>Foo.png</img></root>
same page in Opera produces right result:
<?xml version="1.0"?><root><img>Foo.png</img></root>
Attached file testcase
Cant' reproduce with current trunk (beta 2)
... which is
Mozilla/5.0 (Windows; Windows NT 5.1; en-US; rv:2.0b2pre) Gecko/20100715 Minefield/4.0b2pre
Worksforme on trunk as well.

Furthermore, I can't find a mozilla-central build at all with the wrong behavior (even going back to before the branchpoint for 3.6).  So this is a branch-only bug.

j.j., do you have time to hunt down using branch nightlies when this appeared?
Version: unspecified → 1.9.2 Branch
Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.7) Gecko/20100713 Firefox/3.6.7

Works in Fx 3.6.7
Ah, ok.  Marking duplicate of the bug with the relevant fix.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: