Created
June 12, 2024 20:26
-
-
Save betodealmeida/af4c4d07be826233789c63ca44a70463 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
<![CDATA[ | |
/* | |
* Firefox doesn't support `disable-output-escaping="yes"`, | |
* so we need to unescape the HTML content manually. | |
* | |
* See this bug ticket from 2001 (!): https://bugzilla.mozilla.org/show_bug.cgi?id=98168 | |
*/ | |
function isFirefox() { | |
return navigator.userAgent.toLowerCase().indexOf('firefox') > -1; | |
} | |
function unescapeHTML(escapedHTML) { | |
const tempDiv = document.createElement('div'); | |
tempDiv.innerHTML = escapedHTML; | |
return tempDiv.textContent || tempDiv.innerText || ""; | |
} | |
addEventListener("DOMContentLoaded", function() { | |
if (isFirefox()) { | |
const divElements = document.querySelectorAll('div.e-content'); | |
divElements.forEach(div => { | |
const escapedHTML = div.innerHTML; | |
const unescapedHTML = unescapeHTML(escapedHTML); | |
div.innerHTML = unescapedHTML; | |
}); | |
} | |
}); | |
]]> | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment