ContentVisibilityAutoStateChangeEvent: skipped property

The skipped read-only property of the ContentVisibilityAutoStateChangeEvent interface returns true if the user agent skips the element's contents, or false otherwise.

Value

A boolean. Returns true if the user agent skips the element's contents, or false otherwise.

Examples

const canvasElem = document.querySelector("canvas");

canvasElem.addEventListener("contentvisibilityautostatechange", stateChanged);
canvasElem.style.contentVisibility = "auto";

function stateChanged(event) {
  if (event.skipped) {
    stopCanvasUpdates(canvasElem);
  } else {
    startCanvasUpdates(canvasElem);
  }
}

// Call this when the canvas updates need to start.
function startCanvasUpdates(canvas) {
  // …
}

// Call this when the canvas updates need to stop.
function stopCanvasUpdates(canvas) {
  // …
}

Specifications

Specification
CSS Containment Module Level 2
# dom-contentvisibilityautostatechangeevent-skipped

Browser compatibility

BCD tables only load in the browser

See also