# A “script” element with a “type” attribute whose value is neither a JavaScript MIME type, “module”, “importmap”, nor “speculationrules” (i.e., a data block) must not have a “fetchpriority” attribute.

> Canonical HTML version: https://rocketvalidator.com/html-validation/a-script-element-with-a-type-attribute-whose-value-is-neither-a-javascript-mime-type-module-importmap-nor-speculationrules-i-e-a-data-block-must-not-have-a-fetchpriority-attribute
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `fetchpriority` attribute is invalid on a `<script>` element whose `type` marks it as a data block, because the browser never downloads a data block and has no request to prioritize.

When the `type` attribute is anything other than a JavaScript MIME type, `module`, `importmap`, or `speculationrules`, the browser treats the element as a data block: inline content that other scripts on the page can read, but that never runs. JSON-LD structured data in `type="application/ld+json"` is the most common example.

`fetchpriority` takes `high`, `low` or `auto` and tells the browser how urgently to download an external script compared with other resources on the page. A data block can't have a `src` and the browser never requests it, so the hint has nothing to apply to.

The markup is often valid when the server sends it. Some script optimizers rewrite the `type` so the browser skips the script on load, then run it later with their own loader. Cloudflare Rocket Loader, for example, turns `type="module"` into a prefixed value such as `type="a1b2c3d4-module"`. The validator checks the rewritten markup, finds an unknown `type`, and reports the `fetchpriority` and `src` attributes as well as the `type` value itself.

## Invalid example

```html
<script type="a1b2c3d4-module" src="/js/gallery.js" fetchpriority="low"></script>
```

## Valid example

```html
<script data-cfasync="false" type="module" src="/js/gallery.js" fetchpriority="low"></script>
```

`data-cfasync="false"` tells Rocket Loader to leave the script alone, so the browser receives the original `type="module"`. Cloudflare requires it before the `src` attribute. Turning Rocket Loader off for the site also works.

If the element really is a data block, such as JSON-LD, remove `fetchpriority` from it. If it was meant to run and the `type` holds a typo, fix the `type` instead: use `module`, a JavaScript MIME type such as `text/javascript`, or leave `type` out.
