diff --git a/packages/provider/src/provider.js b/packages/provider/src/provider.js index 52eda0acba6e182345d72e58e04f5e528b16210f..014090eef46bb59fb661e0430796e71f140e3fba 100644 --- a/packages/provider/src/provider.js +++ b/packages/provider/src/provider.js @@ -97,6 +97,25 @@ export class Provider extends HTMLElement { e.stopPropagation(); } }, false); + + // Options for the observer (which mutations to observe) + const config = { attributes: true, childList: false, subtree: false }; + + // Callback function to execute when mutations are observed + const callback = function(mutationsList, observer) { + // Use traditional 'for loops' for IE 11 + for(const mutation of mutationsList) { + if (mutation.type === 'attributes') { + console.log('The ' + mutation.attributeName + ' attribute was modified.'); + } + } + }; + + // Create an observer instance linked to the callback function + const observer = new MutationObserver(callback); + + // Start observing the target node for configured mutations + observer.observe(this, config); } id() {