Skip to content

pantoken-root / formats/scope/src / resolveScope

Hàm: resolveScope() ​

resolveScope(start): ResolvedScope

Beta

Giải quyết scope đang có hiệu lực cho start bằng cách đi lên các ancestor của nó.

Tham số ​

start ​

Element | null

Phần tử cần được giải quyết. Các thuộc tính của chính nó cũng tham gia.

Trả về ​

ResolvedScope

The ResolvedScope; các trường mà không có ancestor nào khai báo sẽ để undefined.

Ví dụ ​

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

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