script with onload show "statment expected"

Hey,

I have a piece of code

<div id="gpay"></div>
<script async onload="onGooglePayLoaded()" src="https://pay.google.com/gp/p/js/pay.js"></script>

And webstorm at the end of script says "statement expected". Also in following lines on empty spaces it reports "Expecting newline or semicolon"

The code is valid, compiles and works. However, I do not know how to turn off or disable html inspection for this particular piece

You can replicate issue by copy pasting

 

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div>
<p>test</p>
<div id="gpay"></div>
<script async onload="onGooglePayLoaded()" src="https://pay.google.com/gp/p/js/pay.js"></script>
<div class="margin"></div>
<p>test</p>
</div>
</body>
</html>
3 comments

Ah I see. Is there any way of ignoring inspection for HTML like in JS or typescirpt files?

0

it's not an inspection unfortunately, it's a syntax error reported by parser:( Such errors can't be suppressed like inspections, the only way to get rid of it is turning file highlighting level to None using Hector icon in lower right corner:

 

You will then need to re-open the project to get highlighting updated

1

Please sign in to leave a comment.