diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2014-05-27 17:30:56 +0200 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2014-05-27 17:30:56 +0200 |
commit | f5de03208e80bec1a9be689b55c93d4faade2de0 (patch) | |
tree | fcfae1c39e82c55229bdabfeec14f3d1fe9d3847 /program/js/common.js | |
parent | d4d62ac414a3ba706fb65c581581c419a90d5ac9 (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.js | 4 |
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 |