[]previous and next page

Region

State of one dynamic child region.

State of one dynamic child region. nodes are the DOM nodes the region owns, in order. When anchor is set, content goes before it. Without one, an empty region is placed after marker (the node that preceded it), so it keeps its position while it is empty.

Import#

ts
import type { Region } from "@shadow-js/web/extend";

Signature#

ts
interface Region {
  readonly parent: Node;
  readonly anchor: Node | null;
  marker: Node | null;
  nodes: Node[];
  /**
   * Text nodes this region created or adopted; only these may be reused by string updates. Null for none, the node
   * itself for one (the usual region: a single dynamic text), a Set for more, so most regions allocate no Set.
   */
  texts: Text | Set<Text> | null;
  /**
   * Development only: the server nodes a hydration pass handed this region, kept until its first
   * commit compares their text with the value (`checkClaimedText`).
   */
  claimed?: readonly Node[] | undefined;
}

Members#

Name Type Description
parent readonly parent: Node
anchor readonly anchor: Node | null
marker marker: Node | null
nodes nodes: Node[]
texts texts: Text | Set<Text> | null Text nodes this region created or adopted; only these may be reused by string updates. Null for none, the node itself for one (the usual region: a single dynamic text), a Set for more, so most regions allocate no Set.
claimed? claimed?: readonly Node[] | undefined Development only: the server nodes a hydration pass handed this region, kept until its first commit compares their text with the value (checkClaimedText).