diff --git a/src/ng/directive/ngRepeat.js b/src/ng/directive/ngRepeat.js index 5214acf86345..f081577bc552 100644 --- a/src/ng/directive/ngRepeat.js +++ b/src/ng/directive/ngRepeat.js @@ -363,7 +363,7 @@ var ngRepeatDirective = ['$parse', '$animate', function($parse, $animate) { // if object, extract keys, in enumeration order, unsorted collectionKeys = []; for (var itemKey in collection) { - if (collection.hasOwnProperty(itemKey) && itemKey.charAt(0) !== '$') { + if (hasOwnProperty.call(collection, itemKey) && itemKey.charAt(0) !== '$') { collectionKeys.push(itemKey); } } diff --git a/src/ng/rootScope.js b/src/ng/rootScope.js index 71a82dcda547..03231dbcff4f 100644 --- a/src/ng/rootScope.js +++ b/src/ng/rootScope.js @@ -603,7 +603,7 @@ function $RootScopeProvider() { // copy the items to oldValue and look for changes. newLength = 0; for (key in newValue) { - if (newValue.hasOwnProperty(key)) { + if (hasOwnProperty.call(newValue, key)) { newLength++; newItem = newValue[key]; oldItem = oldValue[key]; @@ -625,7 +625,7 @@ function $RootScopeProvider() { // we used to have more keys, need to find them and destroy them. changeDetected++; for (key in oldValue) { - if (!newValue.hasOwnProperty(key)) { + if (!hasOwnProperty.call(newValue, key)) { oldLength--; delete oldValue[key]; } diff --git a/test/ng/directive/ngRepeatSpec.js b/test/ng/directive/ngRepeatSpec.js index 1205a8701b9f..840a72bf19dc 100644 --- a/test/ng/directive/ngRepeatSpec.js +++ b/test/ng/directive/ngRepeatSpec.js @@ -166,6 +166,18 @@ describe('ngRepeat', function() { expect(element.text()).toEqual('age:20|wealth:20|prodname:Bingo|dogname:Bingo|codename:20|'); }); + it('should iterate over an object/map not inheriting from Object.prototype', function() { + element = $compile( + '