Skip to content

Commit f2419a7

Browse files
committed
support config.ignoredElements
1 parent f058a21 commit f2419a7

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/core/config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export type Config = {
66
optionMergeStrategies: { [key: string]: Function },
77
silent: boolean,
88
errorHandler: ?Function,
9+
ignoredElements: ?Array<string>,
910
isReservedTag: (x?: string) => boolean,
1011
isUnknownElement: (x?: string) => boolean,
1112
mustUseProp: (x?: string) => boolean,
@@ -32,6 +33,11 @@ const config: Config = {
3233
*/
3334
errorHandler: null,
3435

36+
/**
37+
* Ignore certain custom elements
38+
*/
39+
ignoredElements: null,
40+
3541
/**
3642
* Check if a tag is reserved so that it cannot be registered as a
3743
* component. This is platform-dependent and may be overwritten.

src/core/vdom/create-element.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,19 @@ export function renderElement (
5353
let Ctor
5454
if (config.isReservedTag(tag)) {
5555
return new VNode(
56-
tag, data, undefined,
57-
undefined, undefined, namespace, context, host
56+
tag, data,
57+
undefined, undefined, undefined,
58+
namespace, context, host
5859
)
5960
} else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {
6061
return createComponent(Ctor, data, parent, context, host, tag)
6162
} else {
6263
if (process.env.NODE_ENV !== 'production') {
63-
if (!namespace && config.isUnknownElement(tag)) {
64+
if (
65+
!namespace &&
66+
!(config.ignoredElements && config.ignoredElements.indexOf(tag) > -1) &&
67+
config.isUnknownElement(tag)
68+
) {
6469
warn(
6570
'Unknown custom element: <' + tag + '> - did you ' +
6671
'register the component correctly? For recursive components, ' +
@@ -69,8 +74,9 @@ export function renderElement (
6974
}
7075
}
7176
return new VNode(
72-
tag, data, undefined,
73-
undefined, undefined, namespace, context, host
77+
tag, data,
78+
undefined, undefined, undefined,
79+
namespace, context, host
7480
)
7581
}
7682
} else {

0 commit comments

Comments
 (0)