Skip to content

Commit

Permalink
Honor safe flag when retrieving cache. Closes #278.
Browse files Browse the repository at this point in the history
  • Loading branch information
gyoshev committed Aug 29, 2014
1 parent 5cf001b commit 0cc2b86
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/kendo.core.js
Expand Up @@ -2506,7 +2506,8 @@ function pad(number, digits, end) {
},

getter: function(expression, safe) {
return getterCache[expression] = getterCache[expression] || new Function("d", "return " + kendo.expr(expression, safe));
var key = expression + safe;
return getterCache[key] = getterCache[key] || new Function("d", "return " + kendo.expr(expression, safe));
},

setter: function(expression) {
Expand Down
6 changes: 6 additions & 0 deletions tests/core/accessor.js
Expand Up @@ -100,6 +100,12 @@ test("getter access property with safe options type is correct", function() {
equal(getter("foo.bar", true)(dataItem), 0);
});

test("getter cache honors safe flag", function() {
var dataItem = {};
getter("foo.bar");
equal(getter("foo.bar", true)(dataItem), undefined);
});

test("setter creates function which sets the specified expression", function() {
var data = { foo: "foo" };

Expand Down

0 comments on commit 0cc2b86

Please sign in to comment.