зеркало из https://github.com/mozilla/pjs.git
bug 188339, improve transformiix standalone DOM, get rid of childNodes in Attr, r=peterv, not part of build
This commit is contained in:
Родитель
47798fb261
Коммит
d1d9ccb2ae
|
@ -87,36 +87,19 @@ Attr::~Attr()
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//Retrieve the value of the attribute. This is a comma-deliminated string
|
//Retrieve the value of the attribute.
|
||||||
//representation of the Attribute's children.
|
|
||||||
//
|
//
|
||||||
const String& Attr::getValue()
|
const String& Attr::getValue()
|
||||||
{
|
{
|
||||||
nodeValue = NULL_STRING;
|
|
||||||
|
|
||||||
Node* child = getFirstChild();
|
|
||||||
while (child) {
|
|
||||||
if (child->getNodeType() != Node::ENTITY_REFERENCE_NODE) {
|
|
||||||
nodeValue.Append(child->getNodeValue());
|
|
||||||
child = child->getNextSibling();
|
|
||||||
if (child)
|
|
||||||
nodeValue.Append(PRUnichar(','));
|
|
||||||
} else {
|
|
||||||
child = child->getNextSibling();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nodeValue;
|
return nodeValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//Create a new Text node and add it to the Attribute's list of children. Also
|
//Set the nodevalue to the given value.
|
||||||
//set the Specified flag to true.
|
|
||||||
//
|
//
|
||||||
void Attr::setValue(const String& newValue)
|
void Attr::setValue(const String& newValue)
|
||||||
{
|
{
|
||||||
NodeDefinition::DeleteChildren();
|
nodeValue = newValue;
|
||||||
|
|
||||||
appendChild(getOwnerDocument()->createTextNode(newValue));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,31 +121,15 @@ void Attr::setNodeValue(const String& nodeValue)
|
||||||
//
|
//
|
||||||
const String& Attr::getNodeValue()
|
const String& Attr::getNodeValue()
|
||||||
{
|
{
|
||||||
return getValue();
|
return nodeValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//First check to see if the new node is an allowable child for an Attr. If it
|
//Not implemented anymore, return null as an error.
|
||||||
//is, call NodeDefinition's implementation of AppendChild. If not, return
|
|
||||||
//null as an error.
|
|
||||||
//
|
//
|
||||||
Node* Attr::appendChild(Node* newChild)
|
Node* Attr::appendChild(Node* newChild)
|
||||||
{
|
{
|
||||||
switch (newChild->getNodeType())
|
NS_ASSERTION(0, "not implemented");
|
||||||
{
|
|
||||||
case Node::TEXT_NODE :
|
|
||||||
{
|
|
||||||
// Remove the "newChild" if it is already a child of this node
|
|
||||||
NodeDefinition* pNewChild = (NodeDefinition*)newChild;
|
|
||||||
if (pNewChild->getParentNode() == this)
|
|
||||||
pNewChild = implRemoveChild(pNewChild);
|
|
||||||
|
|
||||||
return implAppendChild(pNewChild);
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче