Skip to content

pantoken-root / formats/scope/src / resolveScope

関数: resolveScope() ​

resolveScope(start): ResolvedScope

ベータ

start に適用されるスコープを、祖先を辿って解決します。

パラメーター ​

start ​

Element | null

解決対象の要素。自身の属性も影響します。

戻り値 ​

ResolvedScope

ResolvedScope;祖先が宣言しなかったフィールドは undefined のままになります。

例 ​

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

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