Re: Event Sequence

On 8/5/09 8:26 AM, Bo Yang wrote:
> Hi,
>    I got some confused by the DOM Events model. Could you please help me?
>
>    The DOM Events level 3 spec define two event types DOMNodeInserted
> and DOMAttrModified. When certain Attr node get removed from its
> ownerElement.
I assume you mean DOMNodeRemoved and DOMAttrModified.

> Should the implementation generate both the two events
> or just DOMAttrModified? If it should generate two events, what is the
> order? Thanks a lot!
>
> Regards!
> Bo
>
>

DOM 2 Events and DOM 3 Events (still a draft) differ here.
DOM 2 talks only about child nodes, DOM 3 has the special case
for Attr nodes. Note, per DOM 3 if Attr node is removed (or inserted)
DOMNodeRemoved (or DOMNodeInserted) is dispatched to Attr node.

So per DOM 3 DOMNodeRemoved is dispatched to Attr node and 
DOMAttrModified to its ownerElement. DOMNodeRemoved is dispatched before 
removing the attribute and DOMAttrModified after removal.

In case of adding an Attr node, DOMNodeInserted is dispatched to Attr 
node after the Attr has been added to the element. DOMAttrModified is 
dispatched to the ownerElement. Order of these 2 events is not specified.


-Olli

Received on Wednesday, 5 August 2009 08:31:13 UTC