Skip to content

Commit

Permalink
Avoid more common causes of 'blocked script execution' console.error …
Browse files Browse the repository at this point in the history
…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'
  • Loading branch information
eoghanmurray authored Mar 26, 2020
1 parent 6245bee commit c14242e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/rebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit c14242e

Please sign in to comment.