Skip to content

feat: add fetchpriority JSX attribute to img, link, script, and iframe #6802

Description

@Burzmalian

Prerequisites

Describe the Feature Request

Add the standardized fetchpriority / fetchPriority attribute (values: 'high' | 'low' | 'auto') to the JSX type declarations for <img>, <link>, <script>, and <iframe> elements in stencil-public-runtime.ts.

Describe the Use Case

Developers using Stencil components that render these elements need type-safe access to fetchpriority to hint resource loading priority to the browser — e.g. marking above-the-fold hero images as fetchpriority="high" or deferring non-critical scripts as fetchpriority="low". Without the type declaration, TypeScript flags this as an error.

Describe Preferred Solution

Add both the camelCase (fetchPriority) and lowercase (fetchpriority) variants to JSXBase.IframeHTMLAttributes, JSXBase.ImgHTMLAttributes, JSXBase.LinkHTMLAttributes, and JSXBase.ScriptHTMLAttributes, following the same dual-property convention already used for crossOrigin/crossorigin, srcSet/srcset, etc.

Describe Alternatives

Consumers can currently work around this by casting to any or using // @ts-ignore, which is undesirable.

Related Code

// currently causes a TypeScript error:
<img src="hero.webp" fetchpriority="high" />

// after this change, typed correctly:
<img src="hero.webp" fetchPriority="high" />

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions