mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-30 08:38:15 +01:00
Dispatch DOMCharacterDataModified as well
This commit is contained in:
parent
3fbde80063
commit
dc1c1c0225
1 changed files with 18 additions and 0 deletions
|
@ -4,6 +4,12 @@
|
||||||
#include <DOM/CharacterData.hpp>
|
#include <DOM/CharacterData.hpp>
|
||||||
#include <DOM/Simple/NodeImpl.hpp>
|
#include <DOM/Simple/NodeImpl.hpp>
|
||||||
|
|
||||||
|
#define DISPATCH_DOM_CHARACTERDATA_MODIFIED_EVENT(oldValue, newValue) \
|
||||||
|
DOM::Events::MutationEvent<stringT> mutationEvent(NodeImpl<stringT, string_adaptorT>::ownerDoc_->createEvent("MutationEvent")); \
|
||||||
|
mutationEvent.initMutationEvent("DOMCharacterDataModified", true, false, Arabica::DOM::Node<stringT>(), oldValue, newValue, "", Arabica::DOM::Events::MutationEvent<std::string>::MODIFICATION); \
|
||||||
|
DOM::Events::EventTarget<stringT> eventTarget(this); \
|
||||||
|
eventTarget.dispatchEvent(mutationEvent); \
|
||||||
|
|
||||||
namespace Arabica
|
namespace Arabica
|
||||||
{
|
{
|
||||||
namespace SimpleDOM
|
namespace SimpleDOM
|
||||||
|
@ -33,7 +39,9 @@ class CharacterDataImpl : virtual public DOM::CharacterData_impl<stringT, string
|
||||||
virtual void setData(const stringT& data)
|
virtual void setData(const stringT& data)
|
||||||
{
|
{
|
||||||
NodeT::throwIfReadOnly();
|
NodeT::throwIfReadOnly();
|
||||||
|
stringT oldValue = data_;
|
||||||
setNodeValue(data);
|
setNodeValue(data);
|
||||||
|
DISPATCH_DOM_CHARACTERDATA_MODIFIED_EVENT(oldValue, data_);
|
||||||
} // setData
|
} // setData
|
||||||
|
|
||||||
virtual int getLength() const
|
virtual int getLength() const
|
||||||
|
@ -54,7 +62,9 @@ class CharacterDataImpl : virtual public DOM::CharacterData_impl<stringT, string
|
||||||
virtual void appendData(const stringT& arg)
|
virtual void appendData(const stringT& arg)
|
||||||
{
|
{
|
||||||
NodeT::throwIfReadOnly();
|
NodeT::throwIfReadOnly();
|
||||||
|
stringT oldValue = data_;
|
||||||
string_adaptorT::append(data_, arg);
|
string_adaptorT::append(data_, arg);
|
||||||
|
DISPATCH_DOM_CHARACTERDATA_MODIFIED_EVENT(oldValue, data_);
|
||||||
} // appendData
|
} // appendData
|
||||||
|
|
||||||
virtual void insertData(int offset, const stringT& arg)
|
virtual void insertData(int offset, const stringT& arg)
|
||||||
|
@ -64,7 +74,9 @@ class CharacterDataImpl : virtual public DOM::CharacterData_impl<stringT, string
|
||||||
if((offset < 0) || (offset > static_cast<int>(string_adaptorT::length(data_))))
|
if((offset < 0) || (offset > static_cast<int>(string_adaptorT::length(data_))))
|
||||||
throw DOM::DOMException(DOM::DOMException::INDEX_SIZE_ERR);
|
throw DOM::DOMException(DOM::DOMException::INDEX_SIZE_ERR);
|
||||||
|
|
||||||
|
stringT oldValue = data_;
|
||||||
string_adaptorT::insert(data_, offset, arg);
|
string_adaptorT::insert(data_, offset, arg);
|
||||||
|
DISPATCH_DOM_CHARACTERDATA_MODIFIED_EVENT(oldValue, data_);
|
||||||
} // insertData
|
} // insertData
|
||||||
|
|
||||||
virtual void deleteData(int offset, int count)
|
virtual void deleteData(int offset, int count)
|
||||||
|
@ -76,7 +88,9 @@ class CharacterDataImpl : virtual public DOM::CharacterData_impl<stringT, string
|
||||||
if(count < 0)
|
if(count < 0)
|
||||||
throw DOM::DOMException(DOM::DOMException::INDEX_SIZE_ERR);
|
throw DOM::DOMException(DOM::DOMException::INDEX_SIZE_ERR);
|
||||||
|
|
||||||
|
stringT oldValue = data_;
|
||||||
string_adaptorT::replace(data_, offset, count, stringT());
|
string_adaptorT::replace(data_, offset, count, stringT());
|
||||||
|
DISPATCH_DOM_CHARACTERDATA_MODIFIED_EVENT(oldValue, data_);
|
||||||
} // deleteData
|
} // deleteData
|
||||||
|
|
||||||
virtual void replaceData(int offset, int count, const stringT& arg)
|
virtual void replaceData(int offset, int count, const stringT& arg)
|
||||||
|
@ -88,7 +102,9 @@ class CharacterDataImpl : virtual public DOM::CharacterData_impl<stringT, string
|
||||||
if(count < 0)
|
if(count < 0)
|
||||||
throw DOM::DOMException(DOM::DOMException::INDEX_SIZE_ERR);
|
throw DOM::DOMException(DOM::DOMException::INDEX_SIZE_ERR);
|
||||||
|
|
||||||
|
stringT oldValue = data_;
|
||||||
string_adaptorT::replace(data_, offset, count, arg);
|
string_adaptorT::replace(data_, offset, count, arg);
|
||||||
|
DISPATCH_DOM_CHARACTERDATA_MODIFIED_EVENT(oldValue, data_);
|
||||||
} // replaceData
|
} // replaceData
|
||||||
|
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
|
@ -102,7 +118,9 @@ class CharacterDataImpl : virtual public DOM::CharacterData_impl<stringT, string
|
||||||
{
|
{
|
||||||
NodeT::throwIfReadOnly();
|
NodeT::throwIfReadOnly();
|
||||||
|
|
||||||
|
stringT oldValue = data_;
|
||||||
data_ = data;
|
data_ = data;
|
||||||
|
DISPATCH_DOM_CHARACTERDATA_MODIFIED_EVENT(oldValue, data_);
|
||||||
} // setNodeValue
|
} // setNodeValue
|
||||||
private:
|
private:
|
||||||
stringT data_;
|
stringT data_;
|
||||||
|
|
Loading…
Add table
Reference in a new issue