aboutsummaryrefslogtreecommitdiff
path: root/webAO/dom/toggleElement.js
diff options
context:
space:
mode:
authorOsmium Sorcerer <os@sof.beauty>2026-06-06 02:27:32 +0000
committerOsmium Sorcerer <os@sof.beauty>2026-06-06 03:09:27 +0000
commit8bf3cae6ac89de9569a7ec629594954804a2b55a (patch)
treed897073049c414e15dd33c0ad1dac4345801b22e /webAO/dom/toggleElement.js
parente0ce108e0806d18353ad85125b2b5f1b1c67e07d (diff)
CSP hardening: remove inline styles
Similar to removal of inline scripts, everything was taken out into the CSS files, with the same styles applied there directly. This lets us use `script-src 'self'` in the CSP. Additionally, serve Golden Layout CSS locally to avoid third-party connection.
Diffstat (limited to 'webAO/dom/toggleElement.js')
-rw-r--r--webAO/dom/toggleElement.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/webAO/dom/toggleElement.js b/webAO/dom/toggleElement.js
index 76a1c633..c87561d0 100644
--- a/webAO/dom/toggleElement.js
+++ b/webAO/dom/toggleElement.js
@@ -4,10 +4,10 @@
*/
export function toggleElement(elementId) {
const element = document.getElementById(elementId);
- if (element.style.display !== "none") {
- element.style.display = "none";
+ if ("nodisplay" in element.classList) {
+ element.classList.remove("nodisplay");
} else {
- element.style.display = "block";
+ element.classList.add("nodisplay");
}
}
window.toggleElement = toggleElement;