From 067b11ef54e529628da48b5dea7e0046b1accbbf Mon Sep 17 00:00:00 2001 From: TechQuery Date: Sat, 9 Nov 2024 16:41:06 +0800 Subject: [PATCH] [fix] ref() should call on Node mounted --- package.json | 2 +- source/dist/DOMRenderer.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 6756ac5..84e1143 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dom-renderer", - "version": "2.4.2", + "version": "2.4.3", "license": "LGPL-3.0-or-later", "author": "shiy2008@gmail.com", "description": "A light-weight DOM Renderer supports Web components standard & TypeScript language", diff --git a/source/dist/DOMRenderer.ts b/source/dist/DOMRenderer.ts index 7b44fb9..e8c7bd7 100644 --- a/source/dist/DOMRenderer.ts +++ b/source/dist/DOMRenderer.ts @@ -61,8 +61,6 @@ export class DOMRenderer { reusedVNode || new VNode({ tagName: vNode.tagName, node: vNode.node }), vNode ); - if (node) vNode.ref?.(node); - return node; } @@ -120,6 +118,8 @@ export class DOMRenderer { for (const vNode of deletingGroup[selector]) this.deleteNode(vNode); this.commitChildren(node, newNodes as ChildNode[]); + + for (const { ref, node } of newList) ref?.(node); } handleCustomEvent(node: EventTarget, event: string) {