Fixing bug 70613. element.innerHTML comes up empty if element is not part of a document hierarchy. r=bzbarsky@mit.edu, sr=rpotts@netscape.com

This commit is contained in:
jst%netscape.com 2001-10-16 00:04:59 +00:00
Родитель 65ba90ca97
Коммит c74ec6b6a3
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -874,7 +874,6 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect,
PRBool done = PR_FALSE;
nsCOMPtr<nsIAtom> tag;
frame->GetContent(getter_AddRefs(content));
if (content) {
@ -1129,7 +1128,9 @@ nsGenericHTMLElement::GetInnerHTML(nsAWritableString& aInnerHTML)
{
aInnerHTML.Truncate();
if (!mDocument) {
nsCOMPtr<nsIDocument> doc;
mNodeInfo->GetDocument(*getter_AddRefs(doc));
if (!doc) {
return NS_OK; // We rely on the document for doing HTML conversion
}
@ -1142,7 +1143,7 @@ nsGenericHTMLElement::GetInnerHTML(nsAWritableString& aInnerHTML)
NS_ENSURE_TRUE(docEncoder, NS_ERROR_FAILURE);
docEncoder->Init(mDocument, NS_LITERAL_STRING("text/html"), 0);
docEncoder->Init(doc, NS_LITERAL_STRING("text/html"), 0);
nsCOMPtr<nsIDOMRange> range(new nsRange);
NS_ENSURE_TRUE(range, NS_ERROR_OUT_OF_MEMORY);