From 6b0d922643f33c73e7e4f02ff643a88a3a2f8470 Mon Sep 17 00:00:00 2001 From: "rbs%maths.uq.edu.au" Date: Tue, 9 Apr 2002 04:12:01 +0000 Subject: [PATCH] Fix dataloss bug 134298: SaveAs leaves private -moz attributes in the output; patch=heikki, r=rbs, sr=jst, a=asa --- content/base/src/nsXMLContentSerializer.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/content/base/src/nsXMLContentSerializer.cpp b/content/base/src/nsXMLContentSerializer.cpp index a3c08442d8b..5e9c8c1b995 100644 --- a/content/base/src/nsXMLContentSerializer.cpp +++ b/content/base/src/nsXMLContentSerializer.cpp @@ -485,6 +485,7 @@ nsXMLContentSerializer::AppendElementStart(nsIDOMElement *aElement, namespaceID, *getter_AddRefs(attrName), *getter_AddRefs(attrPrefix)); + if (attrPrefix) { attrPrefix->ToString(prefixStr); } @@ -500,7 +501,13 @@ nsXMLContentSerializer::AppendElementStart(nsIDOMElement *aElement, content->GetAttr(namespaceID, attrName, valueStr); attrName->ToString(nameStr); - + + // XXX Hack to get around the fact that MathML can add + // attributes starting with '-', which makes them + // invalid XML. + if (!nameStr.IsEmpty() && nameStr.First() == '-') + continue; + SerializeAttr(prefixStr, nameStr, valueStr, aStr, PR_TRUE); if (addNSAttr) {