SVGElement: drawable property

The drawable property of the SVGElement 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 SVG 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 width="480" height="320" content="drawable">
  <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" drawable>
    <circle cx="20" cy="20" r="15" tabindex="0" />
  </svg>
</canvas>

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

js
const svgElem = document.querySelector("svg");
console.log(svgElem.drawable); // true

And set it like this:

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

Specifications

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

Browser compatibility

See also