Skip to content

Commit

Permalink
support config.ignoredElements
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jun 16, 2016
1 parent f058a21 commit f2419a7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/core/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type Config = {
optionMergeStrategies: { [key: string]: Function },
silent: boolean,
errorHandler: ?Function,
ignoredElements: ?Array<string>,
isReservedTag: (x?: string) => boolean,
isUnknownElement: (x?: string) => boolean,
mustUseProp: (x?: string) => boolean,
Expand All @@ -32,6 +33,11 @@ const config: Config = {
*/
errorHandler: null,

/**
* Ignore certain custom elements
*/
ignoredElements: null,

/**
* Check if a tag is reserved so that it cannot be registered as a
* component. This is platform-dependent and may be overwritten.
Expand Down
16 changes: 11 additions & 5 deletions src/core/vdom/create-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,19 @@ export function renderElement (
let Ctor
if (config.isReservedTag(tag)) {
return new VNode(
tag, data, undefined,
undefined, undefined, namespace, context, host
tag, data,
undefined, undefined, undefined,
namespace, context, host
)
} else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {
return createComponent(Ctor, data, parent, context, host, tag)
} else {
if (process.env.NODE_ENV !== 'production') {
if (!namespace && config.isUnknownElement(tag)) {
if (
!namespace &&
!(config.ignoredElements && config.ignoredElements.indexOf(tag) > -1) &&
config.isUnknownElement(tag)
) {
warn(
'Unknown custom element: <' + tag + '> - did you ' +
'register the component correctly? For recursive components, ' +
Expand All @@ -69,8 +74,9 @@ export function renderElement (
}
}
return new VNode(
tag, data, undefined,
undefined, undefined, namespace, context, host
tag, data,
undefined, undefined, undefined,
namespace, context, host
)
}
} else {
Expand Down

0 comments on commit f2419a7

Please sign in to comment.