diff --git a/unpacked/jax/output/CommonHTML/jax.js b/unpacked/jax/output/CommonHTML/jax.js
index 20420ca51..eba9c5d22 100644
--- a/unpacked/jax/output/CommonHTML/jax.js
+++ b/unpacked/jax/output/CommonHTML/jax.js
@@ -360,7 +360,7 @@
// Remove any existing output
//
prev = script.previousSibling;
- if (prev && prev.nodeName.toLowerCase() === "mjx-chtml")
+ if (prev && prev.className.substr(0,9) === "mjx-chtml")
prev.parentNode.removeChild(prev);
//
// Add the node for the math and mark it as being processed