Explorar o código

adjust createElement component/namespaced priority

Evan You %!s(int64=9) %!d(string=hai) anos
pai
achega
e0c77dd48d
Modificáronse 1 ficheiros con 9 adicións e 7 borrados
  1. 9 7
      src/core/vdom/create-element.js

+ 9 - 7
src/core/vdom/create-element.js

@@ -42,21 +42,23 @@ function _createElement (
     return emptyVNode()
   }
   if (typeof tag === 'string') {
-    let Ctor, ns
-    if (config.isReservedTag(tag) || (ns = config.getTagNamespace(tag))) {
+    let Ctor
+    if (config.isReservedTag(tag)) {
       // platform built-in elements
       return new VNode(
-        tag, data, normalizeChildren(children, ns),
-        undefined, undefined, ns, context, host
+        tag, data, normalizeChildren(children),
+        undefined, undefined, undefined, context, host
       )
     } else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {
       // component
       return createComponent(Ctor, data, parent, context, host, children, tag)
     } else {
-      // unknown element, but check at runtime because it may get assigned
-      // a namespace when its parent normalizes children
+      // unknown or namespaced elements
+      // check at runtime because it may get assigned a namespace when its
+      // parent normalizes children
+      const ns = config.getTagNamespace(tag)
       return new VNode(
-        tag, data, normalizeChildren(children),
+        tag, data, normalizeChildren(children, ns),
         undefined, undefined, ns, context, host
       )
     }