Skip to main content
Glama
test-global-dompurify.js1.01 kB
import DOMPurify from 'dompurify'; import { JSDOM } from 'jsdom'; const dom = new JSDOM('<!DOCTYPE html><body></body>'); const purifyInstance = DOMPurify(dom.window); // Set on global global.DOMPurify = purifyInstance; // Test access console.log('global.DOMPurify exists:', typeof global.DOMPurify); console.log('global.DOMPurify.addHook exists:', typeof global.DOMPurify.addHook); // Test if it works like Mermaid expects const testModule = new Function('return typeof DOMPurify !== "undefined" && typeof DOMPurify.addHook === "function"'); console.log('Can access DOMPurify directly:', testModule()); // The real problem: Mermaid code does "DOMPurify.addHook" not "global.DOMPurify.addHook" // In ES modules, we need to check if it's in the global scope console.log('\nMaking DOMPurify truly global...'); globalThis.DOMPurify = purifyInstance; console.log('globalThis.DOMPurify exists:', typeof globalThis.DOMPurify); console.log('globalThis.DOMPurify.addHook exists:', typeof globalThis.DOMPurify.addHook);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Narasimhaponnada/mcp-mermiad'

If you have feedback or need assistance with the MCP directory API, please join our Discord server