Skip to content

Instantly share code, notes, and snippets.

@alessioalex
Created August 24, 2015 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alessioalex/5bc89f176a762b6fc64a to your computer and use it in GitHub Desktop.
Save alessioalex/5bc89f176a762b6fc64a to your computer and use it in GitHub Desktop.
var observer = new MutationObserver(function(mutations) {
//console.log('OBSERVED', mutations);
var observation = parseInt(Math.random() * 100);
console.group('Observation ' + observation);
mutations.forEach(function(mutation) {
console.log('%s: %s', mutation.target.nodeName, mutation.type, mutation);
});
console.groupEnd();
});
var config = {childList: true, attributes: true, characterData: true, subtree: true, attributeOldValue: true, characterDataOldValue: true};
observer.observe($0, config);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment