Skip to main content
Version: 2.x

HTMLView class

@microsoft/fast-element > HTMLView

HTMLView class

The standard View implementation, which also implements ElementView and SyntheticView.

Signature:

export declare class HTMLView<TSource = any, TParent = any> extends DefaultExecutionContext<TParent> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> 

Extends: DefaultExecutionContext<TParent>

Implements: ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent>

Constructors

Constructor

Modifiers

Description

(constructor)(fragment, factories, targets)

Constructs an instance of HTMLView.

Properties

Property

Modifiers

Type

Description

context

ExecutionContext<TParent>

The execution context the view is running within.

firstChild

Node

The first DOM node in the range of nodes that make up the view.

isBound

boolean

Indicates whether the controller is bound.

lastChild

Node

The last DOM node in the range of nodes that make up the view.

source

TSource | null

The data that the view is bound to.

sourceLifetime

readonly

SourceLifetime

Indicates how the source's lifetime relates to the controller's lifetime.

targets

readonly

ViewBehaviorTargets

Methods

Method

Modifiers

Description

appendTo(node)

Appends the view's DOM nodes to the referenced node.

bind(source, context)

Binds a view's behaviors to its binding source.

dispose()

Removes the view and unbinds its behaviors, disposing of DOM nodes afterward. Once a view has been disposed, it cannot be inserted or bound again.

disposeContiguousBatch(views)

static

Efficiently disposes of a contiguous range of synthetic view instances.

insertBefore(node)

Inserts the view's DOM nodes before the referenced node.

onUnbind(behavior)

remove()

Removes the view's DOM nodes. The nodes are not disposed and the view can later be re-inserted.

unbind()

Unbinds a view's behaviors from its binding source.