From 0b3216ecb6def2dd052b2c5b0f1588339b389dea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Alnet?= Date: Fri, 22 May 2015 12:27:08 +0200 Subject: [PATCH] Do not extend Array.prototype --- src/node/utils/toolbar.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/node/utils/toolbar.js b/src/node/utils/toolbar.js index f040fb88..eaa1d421 100644 --- a/src/node/utils/toolbar.js +++ b/src/node/utils/toolbar.js @@ -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; -};