зеркало из https://github.com/mozilla/pjs.git
Bug 199613: Don't put textnodes in the root of the document when parsing XML and XUL since the DOM doesn't allow that.
r=peterv sr=jst
This commit is contained in:
Родитель
cb190dd9e1
Коммит
910d4e886d
|
@ -346,6 +346,15 @@ nsDocumentEncoder::SerializeNodeEnd(nsIDOMNode* aNode,
|
|||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
aNode->GetParentNode(getter_AddRefs(parent));
|
||||
if (parent) {
|
||||
parent->GetNodeType(&type);
|
||||
if (type == nsIDOMNode::DOCUMENT_NODE) {
|
||||
aStr.Append((PRUnichar)'\n');
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -920,6 +929,7 @@ nsDocumentEncoder::EncodeToString(nsAString& aOutputString)
|
|||
rv = mSerializer->AppendDocumentStart(domdoc, aOutputString);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aOutputString.Append((PRUnichar)'\n');
|
||||
nsCOMPtr<nsIDOMNode> doc(do_QueryInterface(mDocument));
|
||||
|
||||
rv = SerializeToStringRecursive(doc, aOutputString);
|
||||
|
|
|
@ -1350,11 +1350,11 @@ NS_IMETHODIMP
|
|||
nsXMLContentSink::HandleCharacterData(const PRUnichar *aData,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if (aData) {
|
||||
result = AddText(aData,aLength);
|
||||
if (aData && mState != eXMLContentSinkState_InProlog &&
|
||||
mState != eXMLContentSinkState_InEpilog) {
|
||||
return AddText(aData, aLength);
|
||||
}
|
||||
return result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -939,11 +939,10 @@ NS_IMETHODIMP
|
|||
XULContentSinkImpl::HandleCharacterData(const PRUnichar *aData,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
if (aData) {
|
||||
result = result = AddText(aData,aLength);
|
||||
if (aData && mState != eInProlog && mState != eInEpilog) {
|
||||
return AddText(aData, aLength);
|
||||
}
|
||||
return result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
Загрузка…
Ссылка в новой задаче