Skip to content

Commit be735d7

Browse files
committed
feat: added isLateTag
1 parent 0a8be45 commit be735d7

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

packages/runtime-core/src/helpers/resolveAssets.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
} from '../component'
77
import { currentRenderingInstance } from '../componentRenderContext'
88
import { Directive } from '../directives'
9-
import { camelize, capitalize, isString } from '@vue/shared'
9+
import {camelize, capitalize, isLateTag, isString} from '@vue/shared'
1010
import { warn } from '../warning'
1111
import { VNodeTypes } from '../vnode'
1212

@@ -106,19 +106,24 @@ function resolveAsset(
106106
resolve(instance[type] || (Component as ComponentOptions)[type], name) ||
107107
// global registration
108108
resolve(instance.appContext[type], name)
109-
109+
debugger
110110
if (!res && maybeSelfReference) {
111111
// fallback to implicit self-reference
112112
return Component
113113
}
114114

115-
if (__DEV__ && warnMissing && !res) {
116-
const extra =
117-
type === COMPONENTS
118-
? `\nIf this is a native custom element, make sure to exclude it from ` +
119-
`component resolution via compilerOptions.isCustomElement.`
120-
: ``
121-
warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`)
115+
if (__DEV__ && warnMissing) {
116+
const isResEmpty = !res;
117+
const isNameLateTag = isLateTag(name);
118+
119+
if ((isResEmpty && !isNameLateTag) || (!isResEmpty && isNameLateTag)) {
120+
const extra =
121+
type === COMPONENTS
122+
? `\nIf this is a native custom element, make sure to exclude it from ` +
123+
`component resolution via compilerOptions.isCustomElement.`
124+
: ``
125+
warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`)
126+
}
122127
}
123128

124129
return res

packages/shared/src/domTagConfig.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const HTML_TAGS =
1414
'option,output,progress,select,textarea,details,dialog,menu,' +
1515
'summary,template,blockquote,iframe,tfoot'
1616

17+
const LATE_ADDED_TAGS = 'search'
18+
1719
// https://developer.mozilla.org/en-US/docs/Web/SVG/Element
1820
const SVG_TAGS =
1921
'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
@@ -45,3 +47,5 @@ export const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS)
4547
* Do NOT use in runtime code paths unless behind `__DEV__` flag.
4648
*/
4749
export const isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS)
50+
51+
export const isLateTag = /*#__PURE__*/ makeMap(LATE_ADDED_TAGS)

0 commit comments

Comments
 (0)