From b1387a710d962914d4f73334ac11cd3cbfc9a859 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Thu, 2 Oct 2003 20:51:09 +0000 Subject: [PATCH] Serialize attributes in the same order as they were parsed (and the opposite of the order in which they were stored, which changed in bug 213347). Bug 218919, r=sicking, sr=jst git-svn-id: svn://10.0.0.236/trunk@147513 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsHTMLContentSerializer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mozilla/content/base/src/nsHTMLContentSerializer.cpp b/mozilla/content/base/src/nsHTMLContentSerializer.cpp index 97205b26f05..7a07d1f4686 100644 --- a/mozilla/content/base/src/nsHTMLContentSerializer.cpp +++ b/mozilla/content/base/src/nsHTMLContentSerializer.cpp @@ -572,7 +572,11 @@ nsHTMLContentSerializer::SerializeAttributes(nsIContent* aContent, NS_NAMED_LITERAL_STRING(_mozStr, "_moz"); - for (index = 0; index < count; index++) { + // Loop backward over the attributes, since the order they are stored in is + // the opposite of the order they were parsed in (see bug 213347 for reason). + // index is unsigned, hence index >= 0 is always true. + for (index = count; index > 0; ) { + --index; aContent->GetAttrNameAt(index, &namespaceID, getter_AddRefs(attrName),