aboutsummaryrefslogtreecommitdiff
path: root/js/classes
diff options
context:
space:
mode:
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-14 11:33:29 +0000
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-11-14 11:33:29 +0000
commitc9f5c056862553d5102d1dfb7d964ea449573d59 (patch)
tree1b005cf7858d8358d76ed3ed8966170a6d4bab99 /js/classes
parent72a4b251503eeb2ae4cc8efdea1f522817652406 (diff)
downloadelgg-c9f5c056862553d5102d1dfb7d964ea449573d59.tar.gz
elgg-c9f5c056862553d5102d1dfb7d964ea449573d59.tar.bz2
Refs #2538: Added vsprintf support to elgg.echo. Added unit tests for normalize_url, added prototype definitions for Array#forEach for compatibility with IE.
git-svn-id: http://code.elgg.org/elgg/trunk@7313 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'js/classes')
-rw-r--r--js/classes/ElggPriorityList.js35
1 files changed, 15 insertions, 20 deletions
diff --git a/js/classes/ElggPriorityList.js b/js/classes/ElggPriorityList.js
index 324b07cac..7b5d16473 100644
--- a/js/classes/ElggPriorityList.js
+++ b/js/classes/ElggPriorityList.js
@@ -28,14 +28,15 @@ elgg.ElggPriorityList.prototype.insert = function(obj, opt_priority) {
elgg.ElggPriorityList.prototype.forEach = function(callback) {
elgg.assertTypeOf('function', callback);
- var index = 0, p, i, elems;
- for (p in this.priorities_) {
- elems = this.priorities_[p];
- for (i in elems) {
- callback(elems[i], index);
- index++;
- }
- }
+ var index = 0;
+
+ this.priorities_.forEach(function(elems) {
+ elems.forEach(function(elem) {
+ callback(elem, index++);
+ });
+ });
+
+ return this;
};
/**
@@ -44,19 +45,13 @@ elgg.ElggPriorityList.prototype.forEach = function(callback) {
elgg.ElggPriorityList.prototype.every = function(callback) {
elgg.assertTypeOf('function', callback);
- var index = 0, p, elems, i;
+ var index = 0;
- for (p in this.priorities_) {
- elems = this.priorities_[p];
- for (i in elems) {
- if (!callback(elems[i], index)) {
- return false;
- }
- index++;
- }
- }
-
- return true;
+ return this.priorities_.every(function(elems) {
+ return elems.every(function(elem) {
+ return callback(elem, index++);
+ });
+ });
};
/**