Skip to content

Instantly share code, notes, and snippets.

@vldvel
Created March 21, 2018 15:04
Show Gist options
  • Save vldvel/533a5298c5484e6fbd38676d30600a05 to your computer and use it in GitHub Desktop.
Save vldvel/533a5298c5484e6fbd38676d30600a05 to your computer and use it in GitHub Desktop.
MutationObserver config
// by default all false
// you can pick as many as you want, but at least one of - attributes, characterData, or childList
const observerConfig = {
attributes: true, // attribute changes will be observed | on add/remove/change attributes
attributeOldValue: true, // will show oldValue of attribute | on add/remove/change attributes | default: null
characterData: true, // data changes will be observed | on add/remove/change characterData
characterDataOldValue: true, // will show OldValue of characterData | on add/remove/change characterData | default: null
childList: true, // target childs will be observed | on add/remove
subtree: true, // target childs will be observed | on attributes/characterData changes if they observed on target
attributeFilter: ['style'] // filter for attributes | array of attributes that should be observed, in this case only style
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment