fix link to dom in components

This commit is contained in:
Nicolas 2025-01-13 18:55:47 +01:00
parent 809a0b8014
commit 9cc97a4214

View file

@ -58,11 +58,13 @@ export function CustomComponent<T extends ConstructorFunction<AbstractComponent>
} }
// Apply any specified CSS classes to the component root element // Apply any specified CSS classes to the component root element
if (p.cssClasses) {
this.classList.add(...p.cssClasses); this.classList.add(...p.cssClasses);
}
// Process and link properties specified in __linkedProperties to their DOM elements // Process and link properties specified in __linkedProperties to their DOM elements
for (const requested of this.__linkedProperties ?? []) { for (const requested of this.__linkedProperties ?? []) {
const elt = findRefElement(requested.ref); const elt = findRefElement(requested.ref, this);
if (elt == null) { if (elt == null) {
throw new Error(`ref ${requested.ref} not found`); throw new Error(`ref ${requested.ref} not found`);
} }