ContentVisibilityAutoStateChangeEvent: ContentVisibilityAutoStateChangeEvent() constructor
Baseline 2024Newly 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
new ContentVisibilityAutoStateChangeEvent(type, options)
Parameters
type
-
A string representing the type of event. In the case of
ContentVisibilityAutoStateChangeEvent
this is alwaysevent
. 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, orfalse
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.
canvasElem.addEventListener("contentvisibilityautostatechange", (event) => {
// …
});
Specifications
Specification |
---|
CSS Containment Module Level 2 # dom-contentvisibilityautostatechangeevent-contentvisibilityautostatechangeevent |
Browser compatibility
BCD tables only load in the browser
See also
- The
contentvisibilityautostatechange
event - CSS Containment
- The
content-visibility
property - The
contain
property