diff --git a/src/addons/api.js b/src/addons/api.js index f5ab97d83..3308574cc 100644 --- a/src/addons/api.js +++ b/src/addons/api.js @@ -64,6 +64,20 @@ const getScratchClassNames = () => { .filter(e => e) .flat(); _scratchClassNames = [...new Set(classes)]; + const observer = new MutationObserver(mutationList => { + for (const mutation of mutationList) { + for (const node of mutation.addedNodes) { + if (node.tagName === 'STYLE') { + _scratchClassNames = null; + observer.disconnect(); + return; + } + } + } + }); + observer.observe(document.head, { + childList: true + }); return _scratchClassNames; };