From 9cc97a42148645b9f23f87850bfd9332f7f1bcc4 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Mon, 13 Jan 2025 18:55:47 +0100 Subject: [PATCH] fix link to dom in components --- src/component.tools.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/component.tools.ts b/src/component.tools.ts index c417cdd..89acf30 100644 --- a/src/component.tools.ts +++ b/src/component.tools.ts @@ -58,11 +58,13 @@ export function CustomComponent } // Apply any specified CSS classes to the component root element - this.classList.add(...p.cssClasses); + if (p.cssClasses) { + this.classList.add(...p.cssClasses); + } // Process and link properties specified in __linkedProperties to their DOM elements for (const requested of this.__linkedProperties ?? []) { - const elt = findRefElement(requested.ref); + const elt = findRefElement(requested.ref, this); if (elt == null) { throw new Error(`ref ${requested.ref} not found`); }