build: Update eslint-config-wikimedia to 0.11.0
[lhc/web/wiklou.git] / resources / src / mediawiki.widgets / mw.widgets.CheckMatrixWidget.js
index 01165ca..b1ab0d2 100644 (file)
@@ -21,6 +21,8 @@
        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(
@@ -63,7 +65,7 @@
                        $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 ) );
                        } );