Very new to chrome ext. development. (&& programming in general) If someone could please help me understand why my appended buttons show up ONLY after the targetNode is hovered.
content_script
let targetNode = document.getElementsByClassName('notranslate')[0];
if (!targetNode){
setTimeout(setBtns, 500);
return;
} else {
let observer = new MutationObserver(record => {
console.log(record);
targetNode.insertAdjacentHTML('beforebegin', editFuncs);
observer.disconnect();
})
observer.observe(targetNode, {
childList: true,
attributes: true,
characterData: true,
subtree: true
})
}
I am trying to make an extension for ~.notion.site/~ and the class 'notranslate' is a dynamic node within the DOM. What I am trying to do is display my buttons stored in 'editFuncs' as a string without having to hover.