aboutsummaryrefslogtreecommitdiff
path: root/js/lib/prototypes.js
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/lib/prototypes.js
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/lib/prototypes.js')
-rw-r--r--js/lib/prototypes.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/js/lib/prototypes.js b/js/lib/prototypes.js
new file mode 100644
index 000000000..0f0014818
--- /dev/null
+++ b/js/lib/prototypes.js
@@ -0,0 +1,44 @@
+/**
+ *
+ */
+if (!Array.prototype.every) {
+ Array.prototype.every = function(callback) {
+ var len = this.length, i;
+
+ for (i = 0; i < len; i++) {
+ if (i in this && !callback.call(null, this[i], i)) {
+ return false;
+ }
+ }
+
+ return true;
+ };
+}
+
+/**
+ *
+ */
+if (!Array.prototype.forEach) {
+ Array.prototype.forEach = function(callback) {
+ var len = this.length, i;
+
+ for (i = 0; i < len; i++) {
+ if (i in this) {
+ callback.call(null, this[i], i);
+ }
+ }
+ };
+}
+
+/**
+ *
+ */
+if (!String.prototype.ltrim) {
+ String.prototype.ltrim = function(str) {
+ if (this.indexOf(str) === 0) {
+ return this.substring(str.length);
+ } else {
+ return this;
+ }
+ };
+} \ No newline at end of file