d4tocchini
10/14/2013 - 8:58 PM

mutate.coffee

handleMutations: (mutations) =>
  for m in mutations
    for node in m.removedNodes
      doSomethingToRemoved node
    for node in m.addedNodes
      doSomethingToAdded node
    if m.type is "characterData" or m.type is "attributes" or m.type is "childList" 
      doSomethingWithType(m)
observer = new MutationObserver handleMutations
observer.observe(document.getElementById('graph'), {subtree: true, childList: true, attributes: false, characterData: false})
#observer.disconnect()