diff --git a/can-view-scope.js b/can-view-scope.js index 717de1d..09710f7 100644 --- a/can-view-scope.js +++ b/can-view-scope.js @@ -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; diff --git a/test/scope-test.js b/test/scope-test.js index 6cc0568..3ca9eae 100644 --- a/test/scope-test.js +++ b/test/scope-test.js @@ -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 }); });