r82403 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82402‎ | r82403 | r82404 >
Date:15:14, 18 February 2011
Author:raymond
Status:ok
Tags:
Comment:
Follow-up r82391 per Nikerabbit's CR: Fix it in a better way
Modified paths:
  • /trunk/phase3/includes/Pager.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Pager.php
@@ -868,12 +868,7 @@
869869
870870 function formatRow( $row ) {
871871 $this->mCurrentRow = $row; # In case formatValue etc need to know
872 - $classArray = $this->getRowAttrs($row);
873 - if ( $classArray['class'] === '' ) {
874 - $s = Html::openElement( 'tr' );
875 - } else {
876 - $s = Html::openElement( 'tr', $classArray );
877 - }
 872+ $s = Xml::openElement( 'tr', $this->getRowAttrs($row) );
878873 $fieldNames = $this->getFieldNames();
879874 foreach ( $fieldNames as $field => $name ) {
880875 $value = isset( $row->$field ) ? $row->$field : null;
@@ -904,7 +899,13 @@
905900 * @return Associative array
906901 */
907902 function getRowAttrs( $row ) {
908 - return array( 'class' => $this->getRowClass( $row ) );
 903+ $class = $this->getRowClass( $row );
 904+ if ( $class === '' ) {
 905+ // Return an empty array to avoid clutter in HTML like class=""
 906+ return array();
 907+ } else {
 908+ return array( 'class' => $this->getRowClass( $row ) );
 909+ }
909910 }
910911
911912 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r85211MFT: r82297, r82307, r82309, r82312, r82315, r82337, r82391, r82392, r82403, ...demon21:01, 2 April 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82391Don't clutter the HTML source with useless class=""raymond11:20, 18 February 2011

Status & tagging log