Sunil Agrawal
Sunil Agrawal

Reputation: 679

Need clarification on MutationObserver APIs

W3C is proposing MutationObserver APIs to replace Mutation Event APIs. More info here : http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#mutation-observers.

I have a newbie question about the new APIs

  1. In the MutationRecord, what's the purpose of previousSibling and nextSibling? Where do they point in case of multiple addedNodes and removedNodes?
  2. If there are multiple added nodes and removed nodes, how to determine the order in which they happened?
  3. Can the same node be in addedNodes and removedNodes, e.g. a node get added and immediately removed? If yes, can the same node appear multiple times in any category, e.g. node got added, removed and added again? If yes, #2 question above becomes more relevant.

FYI, these APIs just showed up on Firefox and Webkit nightly builds (in addition to being present in Chrome).

Thanks, Sunil

Upvotes: 3

Views: 744

Answers (1)

Sunil Agrawal
Sunil Agrawal

Reputation: 679

I found a discussion here which provides some of the answers : http://lists.w3.org/Archives/Public/public-webapps/2011JulSep/1622.html.

Upvotes: 2

Related Questions