Element interface for Shadow Mode. Represents a node in the backend node tree.

interface Element {
    __wxElement?: glassEasel.Element;
    addClass(className): void;
    appendChild(child): void;
    associateValue(v): void;
    createIntersectionObserver?(relativeElement, relativeElementMargin, thresholds, listener): Observer;
    createResizeObserver?(mode, listener): Observer;
    getAllComputedStyles?(cb): void;
    getBoundingClientRect?(cb): void;
    getBoxModel?(cb): void;
    getContext?(cb): void;
    getInheritedRules?(cb): void;
    getMatchedRules?(cb): void;
    getPartialComputedStyles?(properties, cb): void;
    getPartialPseudoComputedStyles?(pseudoType, properties, cb): void;
    getPseudoComputedStyles?(pseudoType, cb): void;
    getPseudoMatchedRules?(pseudoType, cb): void;
    getPseudoTypes?(cb): void;
    getScrollOffset?(cb): void;
    getShadowRoot(): undefined | ShadowRootContext;
    insertBefore(child, before, index?): void;
    manipulateNativeNode?(action, args, cb): void;
    release(): void;
    removeAttribute(name): void;
    removeChild(child, index?): void;
    removeClass(className): void;
    replaceChild(child, oldChild, index?): void;
    setAttribute(name, value): void;
    setClassAlias(className, targets): void;
    setDataset(name, value): void;
    setId(id): void;
    setInheritSlots(): void;
    setListenerStats(type, capture, mutLevel): void;
    setModelBindingStat(attributeName, listener): void;
    setScrollPosition?(scrollLeft, scrollTop, duration): void;
    setSlot(name): void;
    setSlotElement(slot): void;
    setSlotName(slot): void;
    setStyle(styleText, styleSegmentIndex): void;
    setText(content): void;
    spliceAppend(list): void;
    spliceBefore(before, deleteCount, list): void;
    spliceRemove(before, deleteCount): void;
    triggerNativeEvent?(type, detail): void;
}

Hierarchy

Properties

__wxElement?: glassEasel.Element

Internal reference to the glass-easel element.

Methods

  • Add a class to this node. Not called on text nodes. In Shadow Mode, styleScope is not passed.

    Parameters

    • className: string

    Returns void

  • Append a child node. The inserted child is guaranteed to have no parent.

    Parameters

    Returns void

  • Notify that node-related information has been created and set an associated value. Called exactly once on each created node (except text nodes, which are not called).

    Parameters

    Returns void

  • Parameters

    • relativeElement: null | glassEasel.backend.Element
    • relativeElementMargin: string
    • thresholds: number[]
    • listener: ((res) => void)
        • (res): void
        • Parameters

          • res: IntersectionStatus

          Returns void

    Returns Observer

  • Parameters

    • mode: ResizeObserverMode
    • listener: ((res) => void)
        • (res): void
        • Parameters

          • res: ResizeStatus

          Returns void

    Returns Observer

  • Parameters

    • cb: ((res) => void)
        • (res): void
        • Parameters

          • res: GetAllComputedStylesResponses

          Returns void

    Returns void

  • Parameters

    Returns void

  • Parameters

    • cb: ((res) => void)
        • (res): void
        • Parameters

          • res: unknown

          Returns void

    Returns void

  • Parameters

    • cb: ((res) => void)
        • (res): void
        • Parameters

          • res: GetInheritedRulesResponses

          Returns void

    Returns void

  • Parameters

    • cb: ((res) => void)
        • (res): void
        • Parameters

          • res: GetMatchedRulesResponses

          Returns void

    Returns void

  • Parameters

    • properties: string[]
    • cb: ((res) => void)
        • (res): void
        • Parameters

          • res: GetAllComputedStylesResponses

          Returns void

    Returns void

  • Parameters

    • pseudoType: string
    • properties: string[]
    • cb: ((res) => void)
        • (res): void
        • Parameters

          • res: GetAllComputedStylesResponses

          Returns void

    Returns void

  • Parameters

    • pseudoType: string
    • cb: ((res) => void)
        • (res): void
        • Parameters

          • res: GetAllComputedStylesResponses

          Returns void

    Returns void

  • Parameters

    • pseudoType: string
    • cb: ((res) => void)
        • (res): void
        • Parameters

          • res: GetMatchedRulesResponses

          Returns void

    Returns void

  • Parameters

    • cb: ((res) => void)
        • (res): void
        • Parameters

          • res: string[]

          Returns void

    Returns void

  • Parameters

    Returns void

  • For a component node, return its ShadowRootContext; otherwise return undefined. Shadow Mode only.

    Returns undefined | ShadowRootContext

  • Insert a child node. Behavior varies by parameters:

    • Without before and index: equivalent to append.
    • With before or index: insert before that position.
    • With both before and index: index must equal before's position in the child list. If index is not a non-negative integer, it is treated as undefined. The inserted child is guaranteed to have no parent.

    Parameters

    Returns void

  • Parameters

    • action: string
    • args: unknown
    • cb: ((res) => void)
        • (res): void
        • Parameters

          • res: unknown

          Returns void

    Returns void

  • Release this node.

    Returns void

  • Remove an attribute from this node. Not called on text nodes.

    Parameters

    • name: string

    Returns void

  • Remove a child node. The removed child may be reused later. If index is provided, it must equal the child's position in the child list. If index is not a non-negative integer, it is treated as undefined.

    Parameters

    Returns void

  • Remove the specified class (if both name and styleScope match). Not called on text nodes. In Shadow Mode, styleScope is not passed.

    Parameters

    • className: string

    Returns void

  • Replace a child node. Behavior varies by parameters:

    • Without oldChild and index: equivalent to append.
    • With oldChild or index: replace that child.
    • With both oldChild and index: index must equal oldChild's position in the child list. If index is not a non-negative integer, it is treated as undefined. The inserted child is guaranteed to have no parent.

    Parameters

    Returns void

  • Set an attribute on this node. value can be any type. Not called on text nodes.

    Parameters

    • name: string
    • value: unknown

    Returns void

  • Update a class alias of this node. Not called on text nodes. Shadow Mode only.

    Parameters

    • className: string
    • targets: string[]

    Returns void

  • Set a dataset attribute on this node. value can be any type. Not called on text nodes. Shadow Mode only.

    Parameters

    • name: string
    • value: unknown

    Returns void

  • Set the node ID.

    Parameters

    • id: string

    Returns void

  • Mark this node as slot-inherit. For slot-inherit nodes, their children are not considered children in the composed tree, but rather siblings after the node. This allows these children to have different target slots. A node is only set as slot-inherit during initialization, before it has any children. Shadow Mode only.

    Returns void

  • Sync event listener settings on this node. type is the event name; capture indicates whether this is a capture listener; mutLevel indicates the event response type:

    • MutLevel.None: normal response.
    • MutLevel.Mut: mutual-exclusive response; only the first mutual-exclusive listener is executed in a single event bubble round.
    • MutLevel.Final: final response; stops event bubbling and prevents default behavior. Not called on text nodes.

    Parameters

    Returns void

  • Sync data binding settings on this node. attributeName is the field name; listener is the data binding update callback. Only called on normal nodes.

    Parameters

    • attributeName: string
    • listener: null | ((newValue) => void)

    Returns void

  • Parameters

    • scrollLeft: number
    • scrollTop: number
    • duration: number

    Returns void

  • Set the target slot name of this node. Shadow Mode only.

    Parameters

    • name: string

    Returns void

  • Set the target slot of this node. undefined means the node has no target slot; null means the node's target slot is empty (composedParent is empty). Shadow Mode only.

    Parameters

    Returns void

  • Mark this node as a slot node and set its slot name. Shadow Mode only.

    Parameters

    • slot: string

    Returns void

  • Set the style of this node. Not called on text nodes.

    Parameters

    • styleText: string
    • styleSegmentIndex: number

    Returns void

  • Set the text content. Only called on text nodes.

    Parameters

    • content: string

    Returns void

  • Append all nodes contained in list. list must be a fragment node; it should be cleared but may be reused. All inserted nodes are guaranteed to have no parent.

    Parameters

    Returns void

  • Remove deleteCount nodes starting from before, then insert all nodes from list at that position. list must be a fragment node; it should be cleared but may be reused. All inserted nodes are guaranteed to have no parent.

    Parameters

    Returns void

  • Remove deleteCount nodes starting from before.

    Parameters

    Returns void

  • Parameters

    • type: string
    • detail: unknown

    Returns void