Do not extend Array.prototype

pull/2678/head
Stéphane Alnet 2015-05-22 12:27:08 +02:00
parent 757ad765d3
commit 0b3216ecb6
1 changed files with 11 additions and 13 deletions

View File

@ -7,7 +7,16 @@ var _ = require("underscore")
, Button
, ButtonsGroup
, Separator
, defaultButtonAttributes;
, defaultButtonAttributes
, removeItem;
removeItem = function(array,what) {
var ax;
while ((ax = array.indexOf(what)) !== -1) {
array.splice(ax, 1);
}
return array;
};
defaultButtonAttributes = function (name, overrides) {
return {
@ -244,7 +253,7 @@ module.exports = {
buttons = []
}else{
// Remove Save Revision from the right menu
buttons[0].removeItem("savedrevision");
removeItem(buttons[0],"savedrevision");
}
}
@ -254,14 +263,3 @@ module.exports = {
return groups.join(this.separator());
}
};
Array.prototype.removeItem = function() {
var what, a = arguments, L = a.length, ax;
while (L && this.length) {
what = a[--L];
while ((ax = this.indexOf(what)) !== -1) {
this.splice(ax, 1);
}
}
return this;
};