Skip to content

Commit 22ac9de

Browse files
committed
v-if linker should be host-sensitive (fix vuejs#1185)
1 parent 68e0b35 commit 22ac9de

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/directives/if.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ module.exports = {
2121
this.template.appendChild(templateParser.clone(el))
2222
}
2323
// compile the nested partial
24-
var cacheId = (this.vm.constructor.cid || '') + el.outerHTML
24+
var cacheId =
25+
(this.vm.constructor.cid + '.' || '') +
26+
// fix #1185: linker is host-sensitive
27+
(this._host ? this._host._uid + '.' : '') +
28+
el.outerHTML
2529
this.linker = cache.get(cacheId)
2630
if (!this.linker) {
2731
this.linker = compiler.compile(

src/instance/init.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
var mergeOptions = require('../util').mergeOptions
2+
var uid = 0
23

34
/**
45
* The main init sequence. This is called for every
@@ -25,6 +26,8 @@ exports._init = function (options) {
2526
this._directives = [] // all directives
2627
this._childCtors = {} // inherit:true constructors
2728

29+
this._uid = uid++
30+
2831
// a flag to avoid this being observed
2932
this._isVue = true
3033

0 commit comments

Comments
 (0)