Last active
April 8, 2016 09:21
-
-
Save askeing/bb3b7b7f14000f0212df172bd44e1847 to your computer and use it in GitHub Desktop.
MutationObserver of Google Docs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var editor = document.querySelector('.kix-appview-editor'); | |
var observer = new MutationObserver(function (mutations) { | |
mutations.forEach(function (mutation) { | |
var entry = { | |
mutation: mutation, | |
el: mutation.target, | |
value: mutation.target.textContent, | |
oldValue: mutation.oldValue | |
}; | |
console.log('Recording Mutation:', entry); | |
}); | |
}); | |
var options = { | |
subtree: true, | |
childList: true, | |
attributes: false | |
}; | |
observer.observe(editor, options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment