ContentVisibilityAutoStateChangeEvent: skipped property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
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
js
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
- The
contentvisibilityautostatechangeevent - CSS Containment
- The
content-visibilityproperty - The
containproperty