зеркало из https://github.com/mozilla/pjs.git
[XForms] Fix handling of controls bound to CDATA nodes. Bug 334821, r=smaug+aaronr
This commit is contained in:
Родитель
3dafedb277
Коммит
03b00feb71
|
@ -664,13 +664,15 @@ nsXFormsUtils::GetNodeValue(nsIDOMNode* aDataNode, nsAString& aNodeValue)
|
||||||
{
|
{
|
||||||
PRUint16 nodeType;
|
PRUint16 nodeType;
|
||||||
aDataNode->GetNodeType(&nodeType);
|
aDataNode->GetNodeType(&nodeType);
|
||||||
|
aNodeValue = EmptyString();
|
||||||
|
|
||||||
switch(nodeType) {
|
switch(nodeType) {
|
||||||
case nsIDOMNode::ATTRIBUTE_NODE:
|
case nsIDOMNode::ATTRIBUTE_NODE:
|
||||||
case nsIDOMNode::TEXT_NODE:
|
case nsIDOMNode::TEXT_NODE:
|
||||||
|
case nsIDOMNode::CDATA_SECTION_NODE:
|
||||||
// "Returns the string-value of the node."
|
// "Returns the string-value of the node."
|
||||||
aDataNode->GetNodeValue(aNodeValue);
|
aDataNode->GetNodeValue(aNodeValue);
|
||||||
return;
|
break;
|
||||||
|
|
||||||
case nsIDOMNode::ELEMENT_NODE:
|
case nsIDOMNode::ELEMENT_NODE:
|
||||||
{
|
{
|
||||||
|
@ -691,9 +693,10 @@ nsXFormsUtils::GetNodeValue(nsIDOMNode* aDataNode, nsAString& aNodeValue)
|
||||||
NS_ASSERTION(child, "DOMNodeList length is wrong!");
|
NS_ASSERTION(child, "DOMNodeList length is wrong!");
|
||||||
|
|
||||||
child->GetNodeType(&nodeType);
|
child->GetNodeType(&nodeType);
|
||||||
if (nodeType == nsIDOMNode::TEXT_NODE) {
|
if (nodeType == nsIDOMNode::TEXT_NODE ||
|
||||||
|
nodeType == nsIDOMNode::CDATA_SECTION_NODE) {
|
||||||
child->GetNodeValue(aNodeValue);
|
child->GetNodeValue(aNodeValue);
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -702,12 +705,21 @@ nsXFormsUtils::GetNodeValue(nsIDOMNode* aDataNode, nsAString& aNodeValue)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case nsIDOMNode::ENTITY_REFERENCE_NODE:
|
||||||
// namespace, processing instruction, comment, XPath root node
|
case nsIDOMNode::ENTITY_NODE:
|
||||||
NS_WARNING("String value for this node type is not defined");
|
case nsIDOMNode::PROCESSING_INSTRUCTION_NODE:
|
||||||
}
|
case nsIDOMNode::COMMENT_NODE:
|
||||||
|
case nsIDOMNode::DOCUMENT_NODE:
|
||||||
|
case nsIDOMNode::DOCUMENT_TYPE_NODE:
|
||||||
|
case nsIDOMNode::DOCUMENT_FRAGMENT_NODE:
|
||||||
|
case nsIDOMNode::NOTATION_NODE:
|
||||||
|
// String value for these node types is not defined, ie. return the empty
|
||||||
|
// string.
|
||||||
|
break;
|
||||||
|
|
||||||
aNodeValue.Truncate(0);
|
default:
|
||||||
|
NS_ASSERTION(PR_FALSE, "Huh? New node type added to Gecko?!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ void
|
/* static */ void
|
||||||
|
|
Загрузка…
Ссылка в новой задаче