MathMLElement: drawable property

The drawable property of the MathMLElement 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 MathML 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="240" height="180" content="drawable">
  <math display="block" drawable>
    <mrow>
      <mi>E</mi>
      <mo>=</mo>
      <mi>m</mi>
      <msup>
        <mi>c</mi>
        <mn>2</mn>
      </msup>
    </mrow>
  </math>
</canvas>

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

js
const mathElem = document.querySelector("math");
console.log(mathElem.drawable); // true

And set it like this:

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

Specifications

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

Browser compatibility

See also