From 2ea9437e32b9420a5213d9d2fa320cd9221b7193 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Thu, 31 Oct 2013 15:09:44 -0700 Subject: [PATCH] Get rid of OO.ui.extendObject and OO.ui.indexOf Replaced uses of extendObject with $.extend . Replaced the one use of OO.ui.indexOf with Array.prototype.indexOf because that's what everything else was already using. Change-Id: I63f40989057b8065ec977efafbf68d6e22c8e679 --- modules/oojs-ui/OO.ui.Toolbar.js | 2 +- modules/oojs-ui/OO.ui.Widget.js | 2 +- modules/oojs-ui/OO.ui.js | 4 ---- modules/oojs-ui/elements/OO.ui.PopuppableElement.js | 4 ++-- modules/oojs-ui/layouts/OO.ui.StackPanelLayout.js | 2 +- modules/oojs-ui/toolgroups/OO.ui.PopupToolGroup.js | 2 +- modules/oojs-ui/widgets/OO.ui.ButtonWidget.js | 2 +- modules/oojs-ui/widgets/OO.ui.InputLabelWidget.js | 2 +- modules/oojs-ui/widgets/OO.ui.InputWidget.js | 2 +- modules/oojs-ui/widgets/OO.ui.MenuItemWidget.js | 2 +- modules/oojs-ui/widgets/OO.ui.SelectWidget.js | 2 +- 11 files changed, 11 insertions(+), 15 deletions(-) diff --git a/modules/oojs-ui/OO.ui.Toolbar.js b/modules/oojs-ui/OO.ui.Toolbar.js index 44f61f4140..b1110b5a8d 100644 --- a/modules/oojs-ui/OO.ui.Toolbar.js +++ b/modules/oojs-ui/OO.ui.Toolbar.js @@ -141,7 +141,7 @@ OO.ui.Toolbar.prototype.setup = function ( groups ) { } type = constructors[group.type] ? group.type : defaultType; items.push( - new constructors[type]( this, OO.ui.extendObject( { '$$': this.$$ }, group ) ) + new constructors[type]( this, $.extend( { '$$': this.$$ }, group ) ) ); } this.addItems( items ); diff --git a/modules/oojs-ui/OO.ui.Widget.js b/modules/oojs-ui/OO.ui.Widget.js index b057ed6484..76a199ce64 100644 --- a/modules/oojs-ui/OO.ui.Widget.js +++ b/modules/oojs-ui/OO.ui.Widget.js @@ -19,7 +19,7 @@ */ OO.ui.Widget = function OoUiWidget( config ) { // Initialize config - config = OO.ui.extendObject( { 'disabled': false }, config ); + config = $.extend( { 'disabled': false }, config ); // Parent constructor OO.ui.Element.call( this, config ); diff --git a/modules/oojs-ui/OO.ui.js b/modules/oojs-ui/OO.ui.js index a291c89ffd..16332813a0 100644 --- a/modules/oojs-ui/OO.ui.js +++ b/modules/oojs-ui/OO.ui.js @@ -15,10 +15,6 @@ OO.ui = {}; OO.ui.bind = $.proxy; -OO.ui.extendObject = $.extend; - -OO.ui.indexOf = $.inArray; - OO.ui.getUserLanguages = function () { return [ 'en' ]; }; diff --git a/modules/oojs-ui/elements/OO.ui.PopuppableElement.js b/modules/oojs-ui/elements/OO.ui.PopuppableElement.js index 7539256276..e4bc3e9cd1 100644 --- a/modules/oojs-ui/elements/OO.ui.PopuppableElement.js +++ b/modules/oojs-ui/elements/OO.ui.PopuppableElement.js @@ -19,10 +19,10 @@ */ OO.ui.PopuppableElement = function OoUiPopuppableElement( config ) { // Configuration initialization - config = OO.ui.extendObject( { 'popupWidth': 320 }, config ); + config = $.extend( { 'popupWidth': 320 }, config ); // Properties - this.popup = new OO.ui.PopupWidget( OO.ui.extendObject( + this.popup = new OO.ui.PopupWidget( $.extend( { 'align': 'center', 'autoClose': true }, config.popup, { '$$': this.$$, '$autoCloseIgnore': this.$ } diff --git a/modules/oojs-ui/layouts/OO.ui.StackPanelLayout.js b/modules/oojs-ui/layouts/OO.ui.StackPanelLayout.js index 3223751aa1..374bdeca5c 100644 --- a/modules/oojs-ui/layouts/OO.ui.StackPanelLayout.js +++ b/modules/oojs-ui/layouts/OO.ui.StackPanelLayout.js @@ -18,7 +18,7 @@ */ OO.ui.StackPanelLayout = function OoUiStackPanelLayout( config ) { // Config initialization - config = OO.ui.extendObject( { 'scrollable': true }, config ); + config = $.extend( { 'scrollable': true }, config ); // Parent constructor OO.ui.PanelLayout.call( this, config ); diff --git a/modules/oojs-ui/toolgroups/OO.ui.PopupToolGroup.js b/modules/oojs-ui/toolgroups/OO.ui.PopupToolGroup.js index 121848cfb9..8106244d2a 100644 --- a/modules/oojs-ui/toolgroups/OO.ui.PopupToolGroup.js +++ b/modules/oojs-ui/toolgroups/OO.ui.PopupToolGroup.js @@ -21,7 +21,7 @@ */ OO.ui.PopupToolGroup = function OoUiPopupToolGroup( toolbar, config ) { // Configuration initialization - config = OO.ui.extendObject( { 'icon': 'down' }, config ); + config = $.extend( { 'icon': 'down' }, config ); // Parent constructor OO.ui.ToolGroup.call( this, toolbar, config ); diff --git a/modules/oojs-ui/widgets/OO.ui.ButtonWidget.js b/modules/oojs-ui/widgets/OO.ui.ButtonWidget.js index a9a4ee27ac..c59594cad5 100644 --- a/modules/oojs-ui/widgets/OO.ui.ButtonWidget.js +++ b/modules/oojs-ui/widgets/OO.ui.ButtonWidget.js @@ -23,7 +23,7 @@ */ OO.ui.ButtonWidget = function OoUiButtonWidget( config ) { // Configuration initialization - config = OO.ui.extendObject( { 'target': '_blank' }, config ); + config = $.extend( { 'target': '_blank' }, config ); // Parent constructor OO.ui.Widget.call( this, config ); diff --git a/modules/oojs-ui/widgets/OO.ui.InputLabelWidget.js b/modules/oojs-ui/widgets/OO.ui.InputLabelWidget.js index 7e825f93e8..132ffba439 100644 --- a/modules/oojs-ui/widgets/OO.ui.InputLabelWidget.js +++ b/modules/oojs-ui/widgets/OO.ui.InputLabelWidget.js @@ -20,7 +20,7 @@ */ OO.ui.InputLabelWidget = function OoUiInputLabelWidget( config ) { // Config intialization - config = OO.ui.extendObject( { 'input': null }, config ); + config = $.extend( { 'input': null }, config ); // Parent constructor OO.ui.Widget.call( this, config ); diff --git a/modules/oojs-ui/widgets/OO.ui.InputWidget.js b/modules/oojs-ui/widgets/OO.ui.InputWidget.js index 52bd90edba..387684fab7 100644 --- a/modules/oojs-ui/widgets/OO.ui.InputWidget.js +++ b/modules/oojs-ui/widgets/OO.ui.InputWidget.js @@ -20,7 +20,7 @@ */ OO.ui.InputWidget = function OoUiInputWidget( config ) { // Config intialization - config = OO.ui.extendObject( { 'readOnly': false }, config ); + config = $.extend( { 'readOnly': false }, config ); // Parent constructor OO.ui.Widget.call( this, config ); diff --git a/modules/oojs-ui/widgets/OO.ui.MenuItemWidget.js b/modules/oojs-ui/widgets/OO.ui.MenuItemWidget.js index 6a51d385f9..9f57ff2082 100644 --- a/modules/oojs-ui/widgets/OO.ui.MenuItemWidget.js +++ b/modules/oojs-ui/widgets/OO.ui.MenuItemWidget.js @@ -17,7 +17,7 @@ */ OO.ui.MenuItemWidget = function OoUiMenuItemWidget( data, config ) { // Configuration initialization - config = OO.ui.extendObject( { 'icon': 'check' }, config ); + config = $.extend( { 'icon': 'check' }, config ); // Parent constructor OO.ui.OptionWidget.call( this, data, config ); diff --git a/modules/oojs-ui/widgets/OO.ui.SelectWidget.js b/modules/oojs-ui/widgets/OO.ui.SelectWidget.js index 06852f9dc9..3c18ed1ca5 100644 --- a/modules/oojs-ui/widgets/OO.ui.SelectWidget.js +++ b/modules/oojs-ui/widgets/OO.ui.SelectWidget.js @@ -317,7 +317,7 @@ OO.ui.SelectWidget.prototype.getRelativeSelectableItem = function ( item, direct var inc = direction > 0 ? 1 : -1, len = this.items.length, index = item instanceof OO.ui.OptionWidget ? - OO.ui.indexOf( item, this.items ) : ( inc > 0 ? -1 : 0 ), + this.items.indexOf( item ) : ( inc > 0 ? -1 : 0 ), stopAt = Math.max( Math.min( index, len - 1 ), 0 ), i = inc > 0 ? // Default to 0 instead of -1, if nothing is selected let's start at the beginning