1//
2// MutationEvent.cpp
3//
4// Library: XML
5// Package: DOM
6// Module: DOMEvents
7//
8// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
9// and Contributors.
10//
11// SPDX-License-Identifier: BSL-1.0
12//
13
14
15#include "Poco/DOM/MutationEvent.h"
16
17
18namespace Poco {
19namespace XML {
20
21
22const XMLString MutationEvent::DOMSubtreeModified = toXMLString("DOMSubtreeModified");
23const XMLString MutationEvent::DOMNodeInserted = toXMLString("DOMNodeInserted");
24const XMLString MutationEvent::DOMNodeRemoved = toXMLString("DOMNodeRemoved");
25const XMLString MutationEvent::DOMNodeRemovedFromDocument = toXMLString("DOMNodeRemovedFromDocument");
26const XMLString MutationEvent::DOMNodeInsertedIntoDocument = toXMLString("DOMNodeInsertedIntoDocument");
27const XMLString MutationEvent::DOMAttrModified = toXMLString("DOMAttrModified");
28const XMLString MutationEvent::DOMCharacterDataModified = toXMLString("DOMCharacterDataModified");
29
30
31MutationEvent::MutationEvent(Document* pOwnerDocument, const XMLString& type):
32 Event(pOwnerDocument, type, 0, true, false),
33 _change(MODIFICATION),
34 _pRelatedNode(0)
35{
36}
37
38
39MutationEvent::MutationEvent(Document* pOwnerDocument, const XMLString& type, EventTarget* pTarget, bool canBubble, bool cancelable, Node* relatedNode):
40 Event(pOwnerDocument, type, pTarget, canBubble, cancelable),
41 _change(MODIFICATION),
42 _pRelatedNode(relatedNode)
43{
44}
45
46
47MutationEvent::MutationEvent(Document* pOwnerDocument, const XMLString& type, EventTarget* pTarget, bool canBubble, bool cancelable, Node* relatedNode,
48 const XMLString& prevValue, const XMLString& newValue, const XMLString& attrName, AttrChangeType change):
49 Event(pOwnerDocument, type, pTarget, canBubble, cancelable),
50 _prevValue(prevValue),
51 _newValue(newValue),
52 _attrName(attrName),
53 _change(change),
54 _pRelatedNode(relatedNode)
55{
56}
57
58
59MutationEvent::~MutationEvent()
60{
61}
62
63
64void MutationEvent::initMutationEvent(const XMLString& type, bool canBubble, bool cancelable, Node* relatedNode,
65 const XMLString& prevValue, const XMLString& newValue, const XMLString& attrName, AttrChangeType change)
66{
67 initEvent(type, canBubble, cancelable);
68 _pRelatedNode = relatedNode;
69 _prevValue = prevValue;
70 _newValue = newValue;
71 _attrName = attrName;
72 _change = change;
73}
74
75
76} } // namespace Poco::XML
77