@microsoft/fast-element > HTMLBindingDirective
HTMLBindingDirective class
The central binding directive that bridges data expressions and DOM updates.
HTMLBindingDirective fulfills three roles simultaneously: - **HTMLDirective**: Produces placeholder HTML via createHTML() during template authoring. - **ViewBehaviorFactory**: Creates behaviors (returns itself) during view creation. - **ViewBehavior / EventListener**: Attaches to a DOM node during bind, manages expression observers for reactive updates, and handles DOM events directly.
The aspectType (set by HTMLDirective.assignAspect during template processing) determines which DOM "sink" function is used to apply values — e.g., setAttribute for attributes, addEventListener for events, textContent for content.
Signature:
export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected, BindingDirective
Implements: HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected, BindingDirective
Constructors
|
Constructor |
Modifiers |
Description |
|---|---|---|
|
Creates an instance of HTMLBindingDirective. |
Properties
|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
The type of aspect to target. | |||
|
string |
The unique id of the factory. | ||
|
DOMPolicy |
The policy that the created behavior must run under. | ||
|
string |
The original source aspect exactly as represented in markup. | ||
|
string |
The evaluated target aspect, determined after processing the source. | ||
|
string |
The structural id of the DOM node to which the created behavior will apply. | ||
|
string | null |
The tagname associated with the target node. |
Methods
|
Method |
Modifiers |
Description |
|---|---|---|
|
Creates a behavior. | ||
|
Creates HTML to be used within a template. |