diff options
| author | Igor Minar | 2011-03-27 15:58:24 -0700 |
|---|---|---|
| committer | Igor Minar | 2011-03-30 15:24:03 -0700 |
| commit | 96a1df192a167e6e34988af687693506f4efd1d1 (patch) | |
| tree | df4603b0e1043500aaecc5c51a257371ad9f2732 /src/widgets.js | |
| parent | 89c25fe7136e49faa88a4b2a1922c822a5470313 (diff) | |
| download | angular.js-96a1df192a167e6e34988af687693506f4efd1d1.tar.bz2 | |
extend size() to take ownPropsOnly param
- extend size() to take size(obj, ownPropsOnly)
- add specs for size()
- update docs to mention string support
- use size() in ng:repeat
including the hasOwnProp check for all object doesn't create
significant perf penalty:
http://jsperf.com/dedicated-code-branch-for-hasownprop
Diffstat (limited to 'src/widgets.js')
| -rw-r--r-- | src/widgets.js | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/widgets.js b/src/widgets.js index a5a8ee79..a7d59289 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -913,19 +913,10 @@ angularWidget('@ng:repeat', function(expression, element){ childCount = children.length, lastIterElement = iterStartElement, collection = this.$tryEval(rhs, iterStartElement), - is_array = isArray(collection), - collectionLength = 0, + collectionLength = size(collection, true), childScope, key; - if (is_array) { - collectionLength = collection.length; - } else { - for (key in collection) - if (collection.hasOwnProperty(key)) - collectionLength++; - } - for (key in collection) { if (collection.hasOwnProperty(key)) { if (index < childCount) { |
