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
This commit is contained in:
Roan Kattouw 2013-10-31 15:09:44 -07:00
parent ac1a386c95
commit 2ea9437e32
11 changed files with 11 additions and 15 deletions

View file

@ -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 );

View file

@ -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 );

View file

@ -15,10 +15,6 @@ OO.ui = {};
OO.ui.bind = $.proxy;
OO.ui.extendObject = $.extend;
OO.ui.indexOf = $.inArray;
OO.ui.getUserLanguages = function () {
return [ 'en' ];
};

View file

@ -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.$ }

View file

@ -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 );

View file

@ -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 );

View file

@ -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 );

View file

@ -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 );

View file

@ -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 );

View file

@ -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 );

View file

@ -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