From 7f0a5f976a4453d5c8c19a9d178b448546dd39c7 Mon Sep 17 00:00:00 2001 From: "neil%parkwaycc.co.uk" Date: Wed, 21 Jul 2004 09:57:49 +0000 Subject: [PATCH] Bug 251686 Old body not deleted when switching out of HTML source mode r=glazou sr=dmose git-svn-id: svn://10.0.0.236/trunk@159570 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/editor/libeditor/html/nsHTMLEditor.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp index 4db01da6ff6..067db688f37 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp @@ -1844,10 +1844,6 @@ nsHTMLEditor::RebuildDocumentFromSource(const nsAString& aSourceString) // Time to change the document nsAutoEditBatch beginBatching(this); - // Try to replace body contents first - res = SelectAll(); - if (NS_FAILED(res)) return res; - nsReadingIterator endtotal; aSourceString.EndReading(endtotal); @@ -1877,6 +1873,9 @@ nsHTMLEditor::RebuildDocumentFromSource(const nsAString& aSourceString) } if (NS_FAILED(res)) return res; + res = SelectAll(); + if (NS_FAILED(res)) return res; + if (!foundbody) { NS_NAMED_LITERAL_STRING(body, ""); // XXX Without recourse to some parser/content sink/docshell hackery