From ca7e31d8abb3680dc40a431244e2acd426e38e33 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Fri, 15 Jul 2005 22:45:14 +0000 Subject: [PATCH] Fix serialization of innerHTML in XML documents. Bug 155723, r=sicking, sr=jst, a=bsmedberg --- content/html/content/src/nsGenericHTMLElement.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 2831f2bcbdee..ca48cf3af313 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -871,12 +871,19 @@ nsGenericHTMLElement::GetInnerHTML(nsAString& aInnerHTML) this))); nsresult rv = NS_OK; + nsAutoString contentType; + doc->GetContentType(contentType); + nsCOMPtr docEncoder; - docEncoder = do_CreateInstance(NS_DOC_ENCODER_CONTRACTID_BASE "text/html"); + docEncoder = + do_CreateInstance(PromiseFlatCString( + nsDependentCString(NS_DOC_ENCODER_CONTRACTID_BASE) + + NS_ConvertUTF16toUTF8(contentType) + ).get()); NS_ENSURE_TRUE(docEncoder, NS_ERROR_FAILURE); - docEncoder->Init(doc, NS_LITERAL_STRING("text/html"), + docEncoder->Init(doc, contentType, nsIDocumentEncoder::OutputEncodeBasicEntities | // Output DOM-standard newlines nsIDocumentEncoder::OutputLFLineBreak |