Просмотр исходного кода

be able to parse the real tag name for the specific platform (#4417)

Hanks 9 лет назад
Родитель
Сommit
cdd36875d6
2 измененных файлов с 7 добавлено и 1 удалено
  1. 6 0
      src/core/config.js
  2. 1 1
      src/core/vdom/create-element.js

+ 6 - 0
src/core/config.js

@@ -12,6 +12,7 @@ export type Config = {
   keyCodes: { [key: string]: number };
   // platform
   isReservedTag: (x?: string) => boolean;
+  parsePlatformTagName: (x: string) => string;
   isUnknownElement: (x?: string) => boolean;
   getTagNamespace: (x?: string) => string | void;
   mustUseProp: (tag?: string, x?: string) => boolean;
@@ -69,6 +70,11 @@ const config: Config = {
    */
   getTagNamespace: noop,
 
+  /**
+   * Parse the real tag name for the specific platform.
+   */
+  parsePlatformTagName: (x: string): string => x,
+
   /**
    * Check if an attribute must be bound using property, e.g. value
    * Platform-dependent.

+ 1 - 1
src/core/vdom/create-element.js

@@ -61,7 +61,7 @@ export function _createElement (
     if (config.isReservedTag(tag)) {
       // platform built-in elements
       vnode = new VNode(
-        tag, data, children,
+        config.parsePlatformTagName(tag), data, children,
         undefined, undefined, context
       )
     } else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {