Skip to content

Commit

Permalink
not including notContext scopes in correct paths (fixes #166)
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipskevin committed Jun 1, 2018
1 parent aef1a03 commit bdef021
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions can-view-scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,11 +446,13 @@ assign(Scope.prototype, {
// `notContext` and `special` contexts can't be read using `../`
var canBeRead = !scope._meta.special && !scope._meta.notContext;

if (canBeRead && typeof scope._context === "object" && canReflect.hasKey(scope._context, normalizedKey)) {
paths[cur + normalizedKey] = scope._context;
}
if (canBeRead) {
if (typeof scope._context === "object" && canReflect.hasKey(scope._context, normalizedKey)) {
paths[cur + normalizedKey] = scope._context;
}

cur += "../";
cur += "../";
}

// walk entire scope tree
return false;
Expand Down
4 changes: 2 additions & 2 deletions test/scope-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1305,8 +1305,8 @@ QUnit.test("scope.getPathsForKey", function() {
"scope.vm.name": vm,
"scope.top.name": top,
"name": nonVm,
"../../../name": vm,
"../../../../../name": top
"../../name": vm,
"../../../name": top
});
});

Expand Down

0 comments on commit bdef021

Please sign in to comment.