CSS: paintWorklet static property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The static, read-only paintWorklet
property of the CSS
interface provides access to the
paint worklet, which programmatically generates an image where a CSS
property expects a file.
Value
The associated 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
Specification |
---|
CSS Painting API Level 1 # ref-for-dom-css-paintworklet |
Browser compatibility
BCD tables only load in the browser