Check that inserted node isn't an ancestor of the new parent

This commit is contained in:
jez 2010-12-26 22:56:15 +00:00
parent a8540e640a
commit d45b5bbcb5

View file

@ -531,6 +531,10 @@ class NodeImplWithChildren : public NodeImpl<stringT, string_adaptorT>,
if(NodeImplT::getOwnerDocument() && childDoc != NodeImplT::getOwnerDocument())
throw DOM::DOMException(DOM::DOMException::WRONG_DOCUMENT_ERR);
for(DOMNode_implT* n = this; n != 0; n = n->getParentNode())
if(n == child)
throw DOM::DOMException(DOM::DOMException::HIERARCHY_REQUEST_ERR);
checkChildType(child);
} // checkCanAdd