From af1d7322466019fe6e2529b2852b33a395356b96 Mon Sep 17 00:00:00 2001 From: Karsten Hassel Date: Wed, 11 Sep 2024 22:20:29 +0200 Subject: [PATCH] remove elements from index.html when loading script or stylesheet files fails --- CHANGELOG.md | 5 ++--- js/loader.js | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eae83538a4..a22ac62ceb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,9 +11,8 @@ _This release is scheduled to be released on 2024-10-01._ ### Added -- [core] removed `config.paths.vendor` (could not work because `vendor` is hardcoded in `index.html`), renamed `config.paths.modules` to `config.foreignModulesDir` -- [core] add variable `MM_CUSTOMCSS_FILE` which - if set - overrides `config.customCss` -- [core] add variable `MM_MODULES_DIR` which - if set - overrides `config.foreignModulesDir` +- [core] removed `config.paths.vendor` (could not work because `vendor` is hardcoded in `index.html`), renamed `config.paths.modules` to `config.foreignModulesDir`, added variable `MM_CUSTOMCSS_FILE` which - if set - overrides `config.customCss`, added variable `MM_MODULES_DIR` which - if set - overrides `config.foreignModulesDir` +- [core] elements are now removed from index.html when loading script or stylesheet files fails ### Removed diff --git a/js/loader.js b/js/loader.js index 02a18d44de..acc77d2801 100644 --- a/js/loader.js +++ b/js/loader.js @@ -176,6 +176,7 @@ const Loader = (function () { }; script.onerror = function () { Log.error("Error on loading script:", fileName); + script.remove(); resolve(); }; document.getElementsByTagName("body")[0].appendChild(script); @@ -193,6 +194,7 @@ const Loader = (function () { }; stylesheet.onerror = function () { Log.error("Error on loading stylesheet:", fileName); + stylesheet.remove(); resolve(); }; document.getElementsByTagName("head")[0].appendChild(stylesheet);