diff --git a/previewers/betatest/js/rocrate.js b/previewers/betatest/js/rocrate.js index 9cad63e..b21bb48 100644 --- a/previewers/betatest/js/rocrate.js +++ b/previewers/betatest/js/rocrate.js @@ -9,13 +9,14 @@ function translateBaseHtmlPage() { async function writeContentAndData(data, fileUrl, file, title, authors) { addStandardPreviewHeader(file, title, authors); + const scripts = document.getElementById("scripts"); var s1 = document.createElement("script"); s1.type = "application/ld+json"; s1.text = data; - document.getElementById("scripts").append(s1); + scripts.append(s1); var s2 = document.createElement("script"); s2.type = "text/javascript"; s2.src = "js/ro-crate-dynamic.js"; - document.getElementById("scripts").append(s2); - dispatchEvent(new Event('load')); + scripts.append(s2); + scripts.dispatchEvent(new Event('load')); }