I am working with the current PWA starter kit template from Polymer.
https://github.com/Polymer/pwa-starter-kit/tree/template-typescript
My web-component element page return the following code with a DIV element:
return html`
${SharedStyles}
<section>
...my content...
</section>
<div id="CONTAINER NAME"></div>
`
I need to get access to the CONTAINER NAME element from an external javascript via document.getElementById. I know that it sit's in the shadow dom but I cant change the external JS. So question is how to make it accessible from JS via document.getElementById?
The external JavaScript loads an iframe into the named div. This external component needs to get the div element by document.getElementById to load the iframe into the specified div.
I have searched and haven't found a way to force the div element from the shadow dom of my web-component page to be exposed/placed in the DOM.
I just found this solution mentioned here but I didnt get it to work in the PWA template. Maybe as the shadow doms are cascaded in the PWA template?
Is there any way I can update the web component based on the Polymer v3/PWA kit with the external javascript (third party) still using document.getElementbyId to modify my div inside the web component?
So looking for a possibility using maybe slots to expose an element of the shadow dom to the light dom? But cant get it to work with the solutions linked above.