X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=Array.js;h=a3b684d73e3b0d28b3aac55260f907e9de402f4d;hb=refs%2Fheads%2Fwip_alan_T6652_pass_gridview_events_into_grid;hp=4095aee53d76776f7435444f9c6c0dad8da84a94;hpb=3443b0e76569dd2d20fb90a5e9a0ae8b0aa830d8;p=roojs1 diff --git a/Array.js b/Array.js index 4095aee53d..a3b684d73e 100644 --- a/Array.js +++ b/Array.js @@ -55,8 +55,34 @@ Roo.applyIf(Array.prototype, { } return res; + }, + /** + * equals + * @param {Array} o The array to compare to + * @returns {Boolean} true if the same + */ + equals : function(b) + { + // https://stackoverflow.com/questions/3115982/how-to-check-if-two-arrays-are-equal-with-javascript + if (this === b) { + return true; + } + if (b == null) { + return false; + } + if (this.length !== b.length) { + return false; + } + + // sort?? a.sort().equals(b.sort()); + + for (var i = 0; i < this.length; ++i) { + if (this[i] !== b[i]) { + return false; + } + } + return true; } - });