Javascript Not Executing Inside Shadow Dom
I am working on an application where I've to load other html webpages to current page. Other webpages are independent applications. I am trying to load webpage in shadow DOM. For t
Solution 1:
To make the <script>
active, you should first insert the loaded file in a <template>
element.
Then use the importNode()
method that will clone the content
of the template and execute the scripts inside.
Instead of:
shadowRoot.innerHTML = response;
Do:
var template = document.createElement( 'template' )
template.innerHTML = response
shadowRoot.appendChild( document.importNode( template.content, true ) )
Post a Comment for "Javascript Not Executing Inside Shadow Dom"