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 '<page>' because the document's frame is sandboxed and the 'allow-scripts' permission is not set'
This commit is contained in:
Eoghan Murray
2026-04-01 12:00:00 +08:00
committed by GitHub
parent eed58d2790
commit dc56ec274a

View File

@@ -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);
}