Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 279
Sunil Agrawal Avatar asked Jun 05 '26 10:06

Sunil Agrawal


1 Answers

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

like image 151
Sunil Agrawal Avatar answered Jun 08 '26 00:06

Sunil Agrawal