summaryrefslogtreecommitdiff
path: root/program/js/common.js
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2014-05-27 17:30:56 +0200
committerThomas Bruederli <thomas@roundcube.net>2014-05-27 17:30:56 +0200
commitf5de03208e80bec1a9be689b55c93d4faade2de0 (patch)
treefcfae1c39e82c55229bdabfeec14f3d1fe9d3847 /program/js/common.js
parentd4d62ac414a3ba706fb65c581581c419a90d5ac9 (diff)
Replace Array.prototype.last() with jQuery.last to avoid side-effects in array iterations
Diffstat (limited to 'program/js/common.js')
-rw-r--r--program/js/common.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/program/js/common.js b/program/js/common.js
index b532c36c1..ee38c3528 100644
--- a/program/js/common.js
+++ b/program/js/common.js
@@ -607,8 +607,8 @@ if (!String.prototype.startsWith) {
}
// array utility function
-Array.prototype.last = function() {
- return this[this.length-1];
+jQuery.last = function(arr) {
+ return arr && arr.length ? arr[arr.length-1] : undefined;
}
// jQuery plugin to emulate HTML5 placeholder attributes on input elements