aboutsummaryrefslogtreecommitdiffstats
path: root/src/widgets.js
diff options
context:
space:
mode:
authorIgor Minar2011-03-27 15:58:24 -0700
committerIgor Minar2011-03-30 15:24:03 -0700
commit96a1df192a167e6e34988af687693506f4efd1d1 (patch)
treedf4603b0e1043500aaecc5c51a257371ad9f2732 /src/widgets.js
parent89c25fe7136e49faa88a4b2a1922c822a5470313 (diff)
downloadangular.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.js11
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) {