BuilderIO / partytown

Relocate resource intensive third-party scripts off of the main thread and into a web worker. 🎉
https://partytown.builder.io
MIT License
13.06k stars 434 forks source link

w3c validation fails with <script type="text/partytown"> #158

Closed migliori closed 2 years ago

migliori commented 2 years ago

Hello,

The w3c validator reports this error: "A script element with a src attribute must not have a type attribute whose value is anything other than the empty string, a JavaScript MIME type, or module"

Would it be possible to provide an alternative, for example this would be valid for the w3c: <script data-type="text/partytown">

Or maybe you have a better suggestion?

Thanks

adamdbradley commented 2 years ago

Sorry but if we didn't provide an unknown type attribute then the browser would execute it. For what it's worth, I did do some research early on and the suggestion from a Google engineer was to start with text/ rather than just partytown, so that it follows the type and subtype pattern: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types