aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoris2025-03-10 08:53:35 +0100
committerJoris2025-03-16 07:52:28 +0100
commit9185cee7c93f294a9ea1b5b0df3c2c81c16e1216 (patch)
treea1fe2c36f1d4c666dd6b5e7e265ab42ecedc1b37 /src
parente9be7fed1c7981dc913e2922a48801c5c41eee3d (diff)
Call onmount when the element is on the page
Otherwise, using the element to call focus for example would not work.
Diffstat (limited to 'src')
-rw-r--r--src/rx.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/rx.ts b/src/rx.ts
index c46c2f5..edd28bf 100644
--- a/src/rx.ts
+++ b/src/rx.ts
@@ -384,7 +384,8 @@ function appendChild(state: State, element: Element, child: Html, lastAdded?: No
appendNode(element, childElement, lastAdded)
if (onmount !== undefined) {
- onmount(childElement)
+ // Wait for the element to be on the page
+ window.setTimeout(() => onmount(childElement), 0)
}
return {