« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/static/js/client-util.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/static/js/client-util.js')
-rw-r--r--src/static/js/client-util.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/static/js/client-util.js b/src/static/js/client-util.js
index de54945c..8ad31b90 100644
--- a/src/static/js/client-util.js
+++ b/src/static/js/client-util.js
@@ -16,9 +16,15 @@ export function rebase(href, rebaseKey = 'rebaseLocalized') {
 
 export function cssProp(el, ...args) {
   if (typeof args[0] === 'string' && args.length === 1) {
-    return getComputedStyle(el).getPropertyValue(args[0]).trim();
+    if (el) {
+      return getComputedStyle(el).getPropertyValue(args[0]).trim();
+    } else {
+      return '';
+    }
   }
 
+  if (!el) return;
+
   if (typeof args[0] === 'string' && args.length === 2) {
     if (args[1] === null) {
       el.style.removeProperty(args[0]);