In a Chrome Extension I'm injecting a content script into the page to create a widget of sorts.
I'm using a shadow DOM to avoid styles clashing. I can't figure out how to get the Javascript to fire in the below example:
content.js
//inject container div from Chrome Extension content script
var container = document.createElement('div');
container.setAttribute('id', 'myContainer');
container.setAttribute('style', 'all: initial');
document.body.appendChild(container);
//create shadow DOM within container
var theShadow = document.querySelector('#myContainer').attachShadow({mode: 'open'});
theShadow.innerHTML = `
<div id="findMe">hello</div>
<script>
var a = document.querySelector("#findMe");
console.log(a.innerHTML);
</script>
`;