aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md3
-rw-r--r--src/widgets.js2
-rw-r--r--test/widgetsSpec.js12
3 files changed, 16 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6ac2fecd..2548c831 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,9 @@
- Change API angular.compile(..) to angular.compile(element)([scope], [cloneAttachFn])
- remove ng:watch directives since it encourages logic in the UI.
+### Bug Fixes
+- Corrected an issue where properties inherited from __proto__ show up in ng:repeat.
+
<a name="0.9.11"><a/>
# <angular/> 0.9.11 snow-maker (2011-02-08) #
diff --git a/src/widgets.js b/src/widgets.js
index d58e7789..fe808740 100644
--- a/src/widgets.js
+++ b/src/widgets.js
@@ -927,7 +927,7 @@ angularWidget('@ng:repeat', function(expression, element){
}
for (key in collection) {
- if (!is_array || collection.hasOwnProperty(key)) {
+ if (collection.hasOwnProperty(key)) {
if (index < childCount) {
// reuse existing child
childScope = children[index];
diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js
index d4d0e43a..183fbe6a 100644
--- a/test/widgetsSpec.js
+++ b/test/widgetsSpec.js
@@ -727,6 +727,18 @@ describe("widget", function(){
expect(element.text()).toEqual('misko:swe;shyam:set;');
});
+ it('should not ng:repeat over parent properties', function(){
+ var Class = function(){};
+ Class.prototype.abc = function(){};
+ Class.prototype.value = 'abc';
+
+ var scope = compile('<ul><li ng:repeat="(key, value) in items" ng:bind="key + \':\' + value + \';\' "></li></ul>');
+ scope.items = new Class();
+ scope.items.name = 'value';
+ scope.$eval();
+ expect(element.text()).toEqual('name:value;');
+ });
+
it('should error on wrong parsing of ng:repeat', function(){
var scope = compile('<ul><li ng:repeat="i dont parse"></li></ul>');