mw.widgets.CheckMatrixWidget = function MWWCheckMatrixWidget( config ) {
var $headRow = $( '<tr>' ),
$table = $( '<table>' ),
+ $thead = $( '<thead>' ),
+ $tbody = $( '<tbody>' ),
widget = this;
config = config || {};
$headRow.append( $( '<td>' ).text( '\u00A0' ) );
// Iterate over the columns object (ignore the value)
- // eslint-disable-next-line no-restricted-properties
+ // eslint-disable-next-line no-jquery/no-each-util
$.each( this.columns, function ( columnLabel ) {
- $headRow.append( $( '<td>' ).html( columnLabel ) );
+ $headRow.append( $( '<th>' ).html( columnLabel ) );
} );
- $table.append( $headRow );
+ $thead.append( $headRow );
// Build table
- // eslint-disable-next-line no-restricted-properties
+ // eslint-disable-next-line no-jquery/no-each-util
$.each( this.rows, function ( rowLabel, rowTag ) {
var $row = $( '<tr>' ),
labelField = new OO.ui.FieldLayout(
$row.append( $( '<td>' ).append( labelField.$element ) );
// Columns
- // eslint-disable-next-line no-restricted-properties
+ // eslint-disable-next-line no-jquery/no-each-util
$.each( widget.columns, function ( columnLabel, columnTag ) {
var thisTag = columnTag + '-' + rowTag,
checkbox = new OO.ui.CheckboxInputWidget( {
$row.append( $( '<td>' ).append( checkbox.$element ) );
} );
- $table.append( $row );
+ $tbody.append( $row );
} );
+ $table
+ .addClass( 'mw-htmlform-matrix mw-widget-checkMatrixWidget-matrix' )
+ .append( $thead, $tbody );
this.$element
.addClass( 'mw-widget-checkMatrixWidget' )
// setDisabled sometimes gets called before the widget is ready
if ( this.checkboxes && Object.keys( this.checkboxes ).length > 0 ) {
// Propagate to all checkboxes and update their disabled state
- // eslint-disable-next-line no-restricted-properties
+ // eslint-disable-next-line no-jquery/no-each-util
$.each( this.checkboxes, function ( name, checkbox ) {
checkbox.setDisabled( widget.isTagDisabled( name ) );
} );