chiark / gitweb /
script: Fiddle with CSS to try to get cursor to update
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 13 Jun 2022 00:26:19 +0000 (01:26 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Jun 2022 09:23:24 +0000 (10:23 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts

index e28b4dd5413f3f8fcac8a3003d903f0329ef4de6..2d2cb56f1946d35028d8488ab253503b0a8f0d20 100644 (file)
@@ -595,16 +595,17 @@ function mousecursor_etc_reupdate() {
   </g></svg>`;
     }
   }
+  // Empirically, setting this to '' and then back to the SVG data
+  // seems to cause Firefox to update it more promptly.
+  style_elem.innerHTML = '';
   if (svg !== undefined) {
     let svg_data = btoa(svg);
     style_text =
 `svg[id=space] {
   cursor: url(data:image/svg+xml;base64,${svg_data}) ${xy}, auto;
 }`;
-  } else {
-    style_text = '';
+    style_elem.innerHTML = style_text;
   }
-  style_elem.innerHTML = style_text;
   recompute_keybindings();
 }