Skip to content

Commit 7b389bc

Browse files
committed
avoid warning unknown custom elements in v-pre
1 parent a52a094 commit 7b389bc

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

flow/vnode.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ declare interface VNodeData {
3434
key?: string | number;
3535
slot?: string;
3636
ref?: string;
37+
pre?: boolean;
3738
tag?: string;
3839
staticClass?: string;
3940
class?: any;

src/compiler/codegen/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ function genData (el: ASTElement): string {
164164
if (el.refInFor) {
165165
data += `refInFor:true,`
166166
}
167+
// pre
168+
if (el.pre) {
169+
data += `pre:true,`
170+
}
167171
// record original tag name for components using "is" attribute
168172
if (el.component) {
169173
data += `tag:"${el.tag}",`

src/core/vdom/patch.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export function createPatchFunction (backend) {
8484
}
8585
}
8686

87+
let inPre = 0
8788
function createElm (vnode, insertedVnodeQueue, nested) {
8889
let i
8990
const data = vnode.data
@@ -103,7 +104,11 @@ export function createPatchFunction (backend) {
103104
const tag = vnode.tag
104105
if (isDef(tag)) {
105106
if (process.env.NODE_ENV !== 'production') {
107+
if (data && data.pre) {
108+
inPre++
109+
}
106110
if (
111+
!inPre &&
107112
!vnode.ns &&
108113
!(config.ignoredElements && config.ignoredElements.indexOf(tag) > -1) &&
109114
config.isUnknownElement(tag)
@@ -124,6 +129,9 @@ export function createPatchFunction (backend) {
124129
if (isDef(data)) {
125130
invokeCreateHooks(vnode, insertedVnodeQueue)
126131
}
132+
if (process.env.NODE_ENV !== 'production' && data && data.pre) {
133+
inPre--
134+
}
127135
} else if (vnode.isComment) {
128136
vnode.elm = nodeOps.createComment(vnode.text)
129137
} else {

0 commit comments

Comments
 (0)