ContentVisibilityAutoStateChangeEvent: ContentVisibilityAutoStateChangeEvent() constructor

Baseline 2024
Newly available

Since September 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

The ContentVisibilityAutoStateChangeEvent() constructor creates a new ContentVisibilityAutoStateChangeEvent object instance.

Syntax

js
new ContentVisibilityAutoStateChangeEvent(type, options)

Parameters

type

A string representing the type of event. In the case of ContentVisibilityAutoStateChangeEvent this is always event.

options Optional

An object that contains the following properties:

skipped

A boolean, which is set to true if the user agent skips the element's contents, or false otherwise.

Examples

A developer would not use this constructor manually. A new ContentVisibilityAutoStateChangeEvent object is constructed when a handler is invoked as a result of the contentvisibilityautostatechange event firing.

js
canvasElem.addEventListener("contentvisibilityautostatechange", (event) => {
  // …
});

Specifications

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

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
ContentVisibilityAutoStateChangeEvent() constructor
Chrome – Full support
Chrome 108 (Release date: 2022-11-29)
footnote Full support
Edge – Full support
Edge 108 (Release date: 2022-12-05)
footnote Full support
Firefox – Full support
Firefox 125 (Release date: 2024-04-16)
footnote Full support
Opera – Full support
Opera 94 (Release date: 2022-12-15)
footnote Full support
Safari – Full support
Safari 18 (Release date: 2024-09-16)
footnote Full support
Chrome Android – Full support
Chrome Android 108 (Release date: 2022-11-29)
footnote Full support
Firefox for Android – Full support
Firefox for Android 125 (Release date: 2024-04-16)
footnote Full support
Opera Android – Full support
Opera Android 73 (Release date: 2023-01-17)
footnote Full support
Safari on iOS – Full support
Safari on iOS 18 (Release date: 2024-09-16)
footnote Full support
Samsung Internet – Full support
Samsung Internet 21 (Release date: 2023-05-19)
footnote Full support
WebView Android – Full support
WebView Android 108 (Release date: 2022-11-29)
footnote Full support
WebView on iOS – Full support
WebView on iOS 18 (Release date: 2024-09-16)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

See also