From 54369b0a96953208c26bd3b8853c13fa099feba4 Mon Sep 17 00:00:00 2001 From: habfast Date: Mon, 10 Nov 2014 19:07:43 +0100 Subject: [PATCH] filter doesn't work when methods are added to Object.prototype `$filter("filter")([{"name":"foo"}], "foo")` will return `[]` if properties/methods are added to Object.prototype because the check isn't done as it should. This simple change fixes that. --- src/ng/filter/filter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ng/filter/filter.js b/src/ng/filter/filter.js index 868199cf22cf..07bed0d90ecc 100644 --- a/src/ng/filter/filter.js +++ b/src/ng/filter/filter.js @@ -197,7 +197,7 @@ function filterFilter() { // jshint +W086 for (var key in expression) { (function(path) { - if (typeof expression[path] === 'undefined') return; + if (typeof expression[path] === 'undefined' || !expression.hasOwnProperty(path)) return; predicates.push(function(value) { return search(path == '$' ? value : (value && value[path]), expression[path]); });