Skip to content

Commit c14242e

Browse files
authored
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'
1 parent 6245bee commit c14242e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/rebuild.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ function buildNode(
128128
try {
129129
if (n.isSVG && name === 'xlink:href') {
130130
node.setAttributeNS('http://www.w3.org/1999/xlink', name, value);
131+
} else if (name == 'onload' || name == 'onclick' || name.substring(0, 7) == 'onmouse') {
132+
// Rename some of the more common atttributes from https://www.w3schools.com/tags/ref_eventattributes.asp
133+
// as setting them triggers a console.error (which shows up despite the try/catch)
134+
// Assumption: these attributes are not used to css
135+
node.setAttribute('_' + name, value);
131136
} else {
132137
node.setAttribute(name, value);
133138
}

0 commit comments

Comments
 (0)