mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-30 08:38:15 +01:00
check ownerdocument of inserted node
This commit is contained in:
parent
36af997d89
commit
a8540e640a
1 changed files with 10 additions and 0 deletions
|
@ -109,6 +109,7 @@ class NamedNodeMapImpl : public DOM::NamedNodeMap_impl<stringT, string_adaptorT>
|
|||
virtual DOMNode_implT* setNamedItem(DOMNode_implT* arg)
|
||||
{
|
||||
throwIfReadOnly();
|
||||
checkOwnerDocument(arg);
|
||||
return setNode(findByName(arg->getNodeName()), dynamic_cast<NodeImplT*>(arg));
|
||||
} // setNamedItem
|
||||
|
||||
|
@ -136,6 +137,7 @@ class NamedNodeMapImpl : public DOM::NamedNodeMap_impl<stringT, string_adaptorT>
|
|||
virtual DOMNode_implT* setNamedItemNS(DOMNode_implT* arg)
|
||||
{
|
||||
throwIfReadOnly();
|
||||
checkOwnerDocument(arg);
|
||||
return setNode(findByNamespaceAndName(arg->getNamespaceURI(), arg->getLocalName()), dynamic_cast<NodeImplT*>(arg));
|
||||
} // setNamedItemNS
|
||||
|
||||
|
@ -167,6 +169,14 @@ class NamedNodeMapImpl : public DOM::NamedNodeMap_impl<stringT, string_adaptorT>
|
|||
throw DOM::DOMException(DOM::DOMException::NO_MODIFICATION_ALLOWED_ERR);
|
||||
} // throwIfReadOnly
|
||||
|
||||
void checkOwnerDocument(const DOMNode_implT* arg)
|
||||
{
|
||||
if(!ownerDoc_)
|
||||
return;
|
||||
if(arg->getOwnerDocument() != ownerDoc_)
|
||||
throw DOM::DOMException(DOM::DOMException::WRONG_DOCUMENT_ERR);
|
||||
} // checkOwnerDocument
|
||||
|
||||
private:
|
||||
typedef std::deque<NodeImplT*> NodeListT;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue