Back to Content

CSS: paintWorklet static property

files/en-us/web/api/css/paintworklet_static/index.md

latest800 B
Original Source

{{APIRef("CSSOM")}}{{SeeCompatTable}}{{SecureContext_Header}}

The static, read-only paintWorklet property of the {{DOMxRef("CSS")}} interface provides access to the paint worklet, which programmatically generates an image where a CSS property expects a file.

Value

The associated {{DOMxRef('Worklet')}} object.

Examples

The following example demonstrates loading a paint worklet from its js file and does so by feature detection.

js
if ("paintWorklet" in CSS) {
  CSS.paintWorklet.addModule("checkerboard.js");
}

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also