.innerHTML wasn't recovering   and this was causing consumers such as View Selection Source to lose it, b=165686, r=jst, sr=bzbarsky

This commit is contained in:
rbs%maths.uq.edu.au 2002-11-20 01:47:06 +00:00
Родитель 797cd62756
Коммит 9cfc8750a9
2 изменённых файлов: 10 добавлений и 2 удалений

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

@ -787,6 +787,9 @@ nsHTMLContentSerializer::AppendToStringWrapped(const nsASingleFragmentString& aS
}
}
static PRUint16 kValNBSP = 160;
static const char* kEntityNBSP = "nbsp";
static PRUint16 kGTVal = 62;
static const char* kEntities[] = {
"", "", "", "", "", "", "", "", "", "",
@ -856,7 +859,11 @@ nsHTMLContentSerializer::AppendToString(const nsAString& aStr,
// needs to be replaced
for (; c < fragmentEnd; c++, advanceLength++) {
PRUnichar val = *c;
if ((val <= kGTVal) && (entityTable[val][0] != 0)) {
if (val == kValNBSP) {
entityText = kEntityNBSP;
break;
}
else if ((val <= kGTVal) && (entityTable[val][0] != 0)) {
entityText = entityTable[val];
break;
} else if (mIsLatin1 && val > 127 && val < 256) {

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

@ -880,7 +880,8 @@ nsGenericHTMLElement::GetInnerHTML(nsAString& aInnerHTML)
NS_ENSURE_TRUE(docEncoder, NS_ERROR_FAILURE);
docEncoder->Init(doc, NS_LITERAL_STRING("text/html"), 0);
docEncoder->Init(doc, NS_LITERAL_STRING("text/html"),
nsIDocumentEncoder::OutputEncodeEntities);
nsCOMPtr<nsIDOMRange> range(new nsRange);
NS_ENSURE_TRUE(range, NS_ERROR_OUT_OF_MEMORY);