From dc56ec274a1ec5f7d9305b0a53bb16eae56daab9 Mon Sep 17 00:00:00 2001 From: Eoghan Murray Date: Wed, 1 Apr 2026 12:00:00 +0800 Subject: [PATCH] Avoid more common causes of 'blocked script execution' console.error messages in Chrome which are not exceptions (but look like them): (#30) 'Blocked script execution in '' because the document's frame is sandboxed and the 'allow-scripts' permission is not set' --- src/rebuild.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/rebuild.ts b/src/rebuild.ts index 4a42d5be..c9be6d23 100644 --- a/src/rebuild.ts +++ b/src/rebuild.ts @@ -128,6 +128,11 @@ function buildNode( try { if (n.isSVG && name === 'xlink:href') { node.setAttributeNS('http://www.w3.org/1999/xlink', name, value); + } else if (name == 'onload' || name == 'onclick' || name.substring(0, 7) == 'onmouse') { + // Rename some of the more common atttributes from https://www.w3schools.com/tags/ref_eventattributes.asp + // as setting them triggers a console.error (which shows up despite the try/catch) + // Assumption: these attributes are not used to css + node.setAttribute('_' + name, value); } else { node.setAttribute(name, value); }