From 00c6a7988b99451cb7e79d92dc8fb37f9cba04fc Mon Sep 17 00:00:00 2001
From: "neil%parkwaycc.co.uk" <neil%parkwaycc.co.uk>
Date: Tue, 28 Mar 2006 16:36:40 +0000
Subject: [PATCH] Fix issues rebuilding <body> attributes from source b=331894
 r=glazou sr=mscott

---
 editor/libeditor/html/nsHTMLEditor.cpp | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp
index 2e2cb99210a0..39845a052b67 100644
--- a/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/editor/libeditor/html/nsHTMLEditor.cpp
@@ -1824,12 +1824,11 @@ nsHTMLEditor::RebuildDocumentFromSource(const nsAString& aSourceString)
   if (!FindInReadable(NS_LITERAL_STRING(">"),beginclosebody,endclosebody))
     return NS_ERROR_FAILURE;
 
-  nsAutoString bodyTag(Substring(beginbody,endclosebody));//<bodyXXXX >
   // Truncate at the end of the body tag
-  
   // Kludge of the year: fool the parser by replacing "body" with "div" so we get a node
-  bodyTag.ReplaceSubstring(NS_LITERAL_STRING("body").get(),
-                           NS_LITERAL_STRING("div").get());
+  nsAutoString bodyTag;
+  bodyTag.AssignLiteral("<div ");
+  bodyTag.Append(Substring(endbody, endclosebody));
 
   nsCOMPtr<nsIDOMRange> range;
   res = selection->GetRangeAt(0, getter_AddRefs(range));