8000 fragment should not be in single mode if the only node is an anchor (… · Mura7/vue@73c2499 · GitHub
[go: up one dir, main page]

Skip to content

Commit 73c2499

Browse files
committed
fragment should not be in single mode if the only node is an anchor (fix vuejs#1784)
1 parent ef97eec commit 73c2499

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/fragment/fragment.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ function Fragment (linker, vm, frag, host, scope, parentFrag) {
2323
parentFrag.childFrags.push(this)
2424
}
2525
this.unlink = linker(vm, frag, host, scope, this)
26-
var single = this.single = frag.childNodes.length === 1
26+
var single = this.single =
27+
frag.childNodes.length === 1 &&
28+
// do not go single mode if the only node is an anchor
29+
!(frag.childNodes[0].__vue_anchor)
2730
if (single) {
2831
this.node = frag.childNodes[0]
2932
this.before = singleBefore

src/util/dom.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,11 @@ exports.isTemplate = function (el) {
285285
*/
286286

287287
exports.createAnchor = function (content, persist) {
288-
return config.debug
288+
var anchor = config.debug
289289
? document.createComment(content)
290290
: document.createTextNode(persist ? ' ' : '')
291+
anchor.__vue_anchor = true
292+
return anchor
291293
}
292294

293295
/**

0 commit comments

Comments
 (0)
0