Jelajahi Sumber

fix script load

Nikolay Suslov 6 tahun lalu
induk
melakukan
e23b28aaec
1 mengubah file dengan 16 tambahan dan 0 penghapusan
  1. 16 0
      support/client/lib/vwf/view/document.js

+ 16 - 0
support/client/lib/vwf/view/document.js

@@ -49,6 +49,20 @@ define( [ "module", "vwf/view", "vwf/utility"], function( module, view, utility)
 
             // At the root node of the application, load the UI chrome if available.
 
+
+            let setInnerHtml = function(elm, html) {
+                elm.innerHTML = html;
+                Array.from(elm.querySelectorAll("script")).forEach(function(el) {
+                  let newEl = document.createElement("script");
+                  Array.from(el.attributes).forEach(function(el) { 
+                    newEl.setAttribute(el.name, el.value)
+                  });
+                  newEl.appendChild(document.createTextNode(el.innerHTML));
+                  el.parentNode.replaceChild(newEl, el);
+                })
+              }
+
+
             if ( childID == this.kernel.application() &&
                     ( window.location.protocol == "http:" || window.location.protocol == "https:" ) ) {
 
@@ -78,6 +92,8 @@ define( [ "module", "vwf/view", "vwf/utility"], function( module, view, utility)
                 // If the overlay attached a `createdNode` handler, forward this first call
                     // since the overlay will have missed it.
 
+                    setInnerHtml(container, responseText);
+
                     if ( self.createdNode !== Object.getPrototypeOf( self ).createdNode ) {
                         self.createdNode( nodeID, childID, childExtendsID, childImplementsIDs,
                             childSource, childType, childURI, childName );