Pad: Fix `<script>` elements in `aceInitInnerdocbodyHead` hook
Using `.innerHTML` to create a `<script>` element does create a DOM node, but the script is not actually executed. Fortunately, creating a DocumentFragment does cause the script to execute.pull/5091/head
parent
7bdd0f2f09
commit
9fcd86b3cd
|
@ -278,9 +278,8 @@ const Ace2Editor = function () {
|
||||||
innerDocument.head.appendChild(innerStyle);
|
innerDocument.head.appendChild(innerStyle);
|
||||||
const headLines = [];
|
const headLines = [];
|
||||||
hooks.callAll('aceInitInnerdocbodyHead', {iframeHTML: headLines});
|
hooks.callAll('aceInitInnerdocbodyHead', {iframeHTML: headLines});
|
||||||
const tmp = innerDocument.createElement('div');
|
innerDocument.head.appendChild(
|
||||||
tmp.innerHTML = headLines.join('\n');
|
innerDocument.createRange().createContextualFragment(headLines.join('\n')));
|
||||||
while (tmp.firstChild) innerDocument.head.appendChild(tmp.firstChild);
|
|
||||||
|
|
||||||
// <body> tag
|
// <body> tag
|
||||||
innerDocument.body.id = 'innerdocbody';
|
innerDocument.body.id = 'innerdocbody';
|
||||||
|
|
Loading…
Reference in New Issue