Skip to content

pantoken-root / formats/scope/src / resolveScope

Function: resolveScope() ​

resolveScope(start): ResolvedScope

Beta

Resolve the scope in effect for start by walking up its ancestors.

Parameters ​

start ​

Element | null

The element to resolve for. Its own attributes participate.

Returns ​

ResolvedScope

The ResolvedScope; fields no ancestor declared are left undefined.

Example ​

ts
import { resolveScope } from "@pantoken/scope";

// <div data-pantoken-theme="canvas"><span id="x"></span></div>
resolveScope(document.querySelector("#x")!).theme; // "canvas"