HTMLElement: drawable property

The drawable property of the HTMLElement interface marks an element as a paint root, meaning that it can be rendered independently on a parent <canvas> element with its content attribute set to drawable, using the HTML-in-Canvas API.

Reflects the value of the HTML drawable attribute.

Value

A boolean — true if the element is marked as a paint root, and false otherwise.

Examples

Basic usage

Given this HTML:

html
<canvas id="canvas" width="300" height="300" content="drawable">
  <div drawable>I can be rendered on the canvas.</div>
</canvas>

You can get the value of the drawable attribute like so:

js
const divElem = document.querySelector("div");
console.log(divElem.drawable); // true

And set it like this:

js
divElem.drawable = false;
console.log(divElem.drawable); // false

Specifications

This feature does not appear to be defined in any specification.

Browser compatibility

See also