Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

docs(test): link upstream happy-dom#2182 for the KaTeX sanitize workaround (#4438)

LearningCircuitd4627aa47e09
diff --git a/tests/js/services/ui.test.js b/tests/js/services/ui.test.js
index 5706afc0f5..ae89a89e5e 100644
--- a/tests/js/services/ui.test.js
+++ b/tests/js/services/ui.test.js
@@ -368,15 +368,16 @@ describe('renderMarkdown with KaTeX math', () => {
it('renders math alongside other markdown', () => {
// The leading "Intro." paragraph is a deliberate sacrificial node.
- // DOMPurify >=3.4.8 reads element names through a cached
- // Node.prototype.nodeName getter; under happy-dom's NodeIterator that
- // path mis-handles the *first* top-level node of the sanitized
- // fragment, dropping its tags while keeping its text (e.g. a leading
- // `<h1>Title</h1>` collapses to `Title`). Real browsers use the native
- // NodeIterator and are unaffected, so this is a test-env-only artifact
- // (tracked upstream against happy-dom). Prefixing a throwaway paragraph
- // keeps the heading off the first slot so we can still assert on its
- // `<h1>` rendering here. See also the MathML note above.
+ // DOMPurify >=3.4.8 reads element names through the cached
+ // Node.prototype.nodeName getter (anti-clobbering hardening). happy-dom's
+ // getter returns "" when invoked that way, so the first top-level node of
+ // the sanitized fragment is treated as an unknown tag and unwrapped — its
+ // tags dropped, text kept (a leading `<h1>Title</h1>` collapses to
+ // `Title`). Real browsers return the correct tag name and are unaffected,
+ // so this is a test-env-only artifact, tracked upstream at
+ // https://github.com/capricorn86/happy-dom/issues/2182. Prefixing a
+ // throwaway paragraph keeps the heading off the first slot so we can still
+ // assert on its `<h1>` rendering here. See also the MathML note above.
const result = ui.renderMarkdown('Intro.\n\n# Title\n\nSome text $x^2$ more text\n\n- list item');
expect(result).toContain('<h1');
expect(result).toContain('<li>');