Browse Source

Support `nomodule` attribute for `canvas.scripts` options

pull/5546/head
Artur Arseniev 3 years ago
parent
commit
6bfc80b418
  1. 7
      src/canvas/view/FrameView.ts

7
src/canvas/view/FrameView.ts

@ -306,8 +306,13 @@ export default class FrameView extends ModuleView<Frame, HTMLIFrameElement> {
type: 'text/javascript',
...(isString(src) ? { src } : src),
});
scriptEl.onerror = scriptEl.onload = appendScript.bind(null, scripts);
el.contentDocument?.head.appendChild(scriptEl);
if (scriptEl.hasAttribute('nomodule') && 'noModule' in HTMLScriptElement.prototype) {
appendScript(scripts);
} else {
scriptEl.onerror = scriptEl.onload = appendScript.bind(null, scripts);
}
} else {
this.renderBody();
em && em.trigger(evLoad, evOpts);

Loading…
Cancel
Save