mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
Use OOUI 'classes' property instead of .addClass()
The 'classes' property is a OOUI interface. Personally, I like this code style better. However. It appears like the code style in this codebase is somewhat mixed. It looks like the top-level .$element always uses .addClass(), while other code uses the 'classes' property. Should we unify this? Change-Id: I9ecd75e22d00f06ffd707f766dc9e8d748ff9a37
This commit is contained in:
parent
3f97610e6e
commit
cdc168d32a
|
@ -12,7 +12,9 @@
|
|||
*/
|
||||
ve.ui.MWTransclusionOutlineButtonWidget = function VeUiMWTransclusionOutlineButtonWidget( config ) {
|
||||
// Parent constructor
|
||||
ve.ui.MWTransclusionOutlineButtonWidget.super.call( this, config );
|
||||
ve.ui.MWTransclusionOutlineButtonWidget.super.call( this, ve.extendObject( config, {
|
||||
classes: [ 've-ui-mwTransclusionOutlineButtonWidget' ]
|
||||
} ) );
|
||||
|
||||
// Mixin constructors
|
||||
OO.ui.mixin.ButtonElement.call( this, {
|
||||
|
@ -24,7 +26,6 @@ ve.ui.MWTransclusionOutlineButtonWidget = function VeUiMWTransclusionOutlineButt
|
|||
}, config ) );
|
||||
|
||||
this.$element
|
||||
.addClass( 've-ui-mwTransclusionOutlineButtonWidget' )
|
||||
.append( this.$button.append( this.$icon, this.$label ) );
|
||||
};
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
*/
|
||||
ve.ui.MWTransclusionOutlineContainerWidget = function VeUiMWTransclusionOutlineContainerWidget() {
|
||||
// Parent constructor
|
||||
ve.ui.MWTransclusionOutlineContainerWidget.super.call( this );
|
||||
ve.ui.MWTransclusionOutlineContainerWidget.super.call( this, {
|
||||
classes: [ 've-ui-mwTransclusionOutlineContainerWidget' ]
|
||||
} );
|
||||
|
||||
// Initialization
|
||||
this.partWidgets = {};
|
||||
|
||||
this.$element.addClass( 've-ui-mwTransclusionOutlineContainerWidget' );
|
||||
};
|
||||
|
||||
/* Inheritance */
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
ve.ui.MWTransclusionOutlineParameterSelectWidget = function VeUiMWTransclusionOutlineParameterSelectWidget( config ) {
|
||||
// Parent constructor
|
||||
ve.ui.MWTransclusionOutlineParameterSelectWidget.super.call( this, ve.extendObject( config, {
|
||||
classes: [ 've-ui-mwTransclusionOutlineParameterSelectWidget' ],
|
||||
multiselect: true
|
||||
} ) );
|
||||
|
||||
|
@ -20,7 +21,6 @@ ve.ui.MWTransclusionOutlineParameterSelectWidget = function VeUiMWTransclusionOu
|
|||
} );
|
||||
|
||||
this.$element
|
||||
.addClass( 've-ui-mwTransclusionOutlineParameterSelectWidget' )
|
||||
.on( {
|
||||
focus: this.bindDocumentKeyDownListener.bind( this ),
|
||||
blur: this.unbindDocumentKeyDownListener.bind( this )
|
||||
|
|
|
@ -39,12 +39,12 @@ ve.ui.MWTransclusionOutlineParameterWidget = function VeUiMWTransclusionOutlineP
|
|||
|
||||
// Parent constructor
|
||||
ve.ui.MWTransclusionOutlineParameterWidget.super.call( this, ve.extendObject( config, {
|
||||
classes: [ 've-ui-mwTransclusionOutlineParameterWidget' ],
|
||||
$label: $( '<label>' )
|
||||
} ) );
|
||||
|
||||
// Initialization
|
||||
this.$element
|
||||
.addClass( 've-ui-mwTransclusionOutlineParameterWidget' )
|
||||
.append( this.checkbox.$element, this.$label );
|
||||
};
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
ve.ui.MWTransclusionOutlinePartWidget = function VeUiMWTransclusionOutlinePartWidget( part, config ) {
|
||||
// Parent constructor
|
||||
ve.ui.MWTransclusionOutlinePartWidget.super.call( this, ve.extendObject( config, {
|
||||
classes: [ 've-ui-mwTransclusionOutlinePartWidget' ],
|
||||
data: part.getId()
|
||||
} ) );
|
||||
|
||||
|
@ -28,7 +29,6 @@ ve.ui.MWTransclusionOutlinePartWidget = function VeUiMWTransclusionOutlinePartWi
|
|||
.connect( this, { click: [ 'emit', 'transclusionPartSelected', part.getId() ] } );
|
||||
|
||||
this.$element
|
||||
.addClass( 've-ui-mwTransclusionOutlinePartWidget' )
|
||||
.append( this.header.$element );
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue