bindProps
Commons
stable
Imperatively apply a props record to a DOM element: event handlers (onXxx keys) are attached via addEventListener with deduplication, attribute keys are set or removed via setAttribute / removeAttribute.
API
Signature
Signature TypeScript complète, extraite du fichier util.
API
Paramètres
Paramètres d'entrée acceptés par cet util.
- elrequisHTMLElement
- The target DOM element to receive the props.
- propsrequisRecord<string, any>
- Object of prop key-value pairs. Keys starting with "on" are treated as event listeners; others are set as attributes. A null/undefined value removes the attribute or the listener.
API
Valeur de retour
La valeur retournée par cet util.
- No return value. Mutations are applied directly to the element.
Usage
Exemples
Extraits de code prêts à coller.
Apply attributes and listeners to a custom element