getContainer

Commons
stable

Resolves the scroll container element from a CSS selector string, a Vue component instance, or an HTMLElement. Falls back to document.scrollingElement or document.body when the argument is omitted or resolves to null.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

el
ComponentPublicInstance | HTMLElement | string
Target descriptor. A string is used as a CSS query selector; a Vue instance unwraps to its root element; an HTMLElement is used directly. Omit to get the document scroll root.

API

Return value

The value returned by this util.

The resolved HTMLElement to use as a scroll container. Never null — falls back to document.scrollingElement or document.body.

Usage

Examples

Ready-to-paste usage snippets.

Resolve a container from different input types

typescript