diff --git a/libs/horizon/src/dom/DOMOperator.ts b/libs/horizon/src/dom/DOMOperator.ts index 9033a028..68bf83b8 100644 --- a/libs/horizon/src/dom/DOMOperator.ts +++ b/libs/horizon/src/dom/DOMOperator.ts @@ -54,7 +54,7 @@ function getChildNS(parentNS: string | null, tagName: string): string { } // 获取容器 -export function getNSCtx(dom: Container, parentNS: string, type: string): string { +export function getNSCtx(dom?: Container, parentNS: string, type: string): string { return dom ? getChildNS(dom.namespaceURI ?? null, dom.nodeName) : getChildNS(parentNS, type); } diff --git a/libs/horizon/src/renderer/ContextSaver.ts b/libs/horizon/src/renderer/ContextSaver.ts index b5200eaa..d092dd76 100644 --- a/libs/horizon/src/renderer/ContextSaver.ts +++ b/libs/horizon/src/renderer/ContextSaver.ts @@ -31,7 +31,7 @@ let ctxOldPreviousContext: Object = {}; // capture阶段设置 function setNamespaceCtx(vNode: VNode, dom?: Container) { - const nextContext = getNSCtx(dom, ctxNamespace, vNode.type); + const nextContext = getNSCtx(ctxNamespace, vNode.type, dom); vNode.setContext(CTX_NAMESPACE, ctxNamespace); ctxNamespace = nextContext;