Options
All
  • Public
  • Public/Protected
  • All
Menu

Class VirtualElement

A virtual node which represents an HTML element.

Notes

User code will not typically create a VirtualElement node directly. Instead, the h() function will be used to create an element tree.

Hierarchy

Index

Type aliases

Constructors

Properties

Type aliases

Static IRenderer

IRenderer: object

A type describing a custom element renderer

Type declaration

Constructors

constructor

  • Construct a new virtual element node.

    Parameters

    • tag: string

      The element tag name.

    • attrs: ElementAttrs

      The element attributes.

    • children: ReadonlyArray<VirtualNode>

      The element children.

    • Optional renderer: IRenderer

      An optional custom renderer for the element.

    Returns VirtualElement

Properties

attrs

The attributes for the element.

children

children: ReadonlyArray<VirtualNode>

The children for the element.

renderer

renderer: IRenderer | undefined

An optional custom renderer for the element's children. If set, on render this element's DOM node and it's attrs will be created/updated as normal. At that point the DOM node is handed off to the renderer.

tag

tag: string

The tag name for the element.

type

type: "element" = "element"

The type of the node.

This value can be used as a type guard for discriminating the VirtualNode union type.

Generated using TypeDoc