From: Raimond Spekking Date: Fri, 18 Feb 2011 15:14:08 +0000 (+0000) Subject: Follow-up r82391 per Nikerabbit's CR: Fix it in a better way X-Git-Tag: 1.31.0-rc.0~31923 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=5e74a2007c8693cfd15dade3def4015824ebd3d0;p=lhc%2Fweb%2Fwiklou.git Follow-up r82391 per Nikerabbit's CR: Fix it in a better way --- diff --git a/includes/Pager.php b/includes/Pager.php index ee150a0bb0..19b61e8d39 100644 --- a/includes/Pager.php +++ b/includes/Pager.php @@ -868,12 +868,7 @@ abstract class TablePager extends IndexPager { function formatRow( $row ) { $this->mCurrentRow = $row; # In case formatValue etc need to know - $classArray = $this->getRowAttrs($row); - if ( $classArray['class'] === '' ) { - $s = Html::openElement( 'tr' ); - } else { - $s = Html::openElement( 'tr', $classArray ); - } + $s = Xml::openElement( 'tr', $this->getRowAttrs($row) ); $fieldNames = $this->getFieldNames(); foreach ( $fieldNames as $field => $name ) { $value = isset( $row->$field ) ? $row->$field : null; @@ -904,7 +899,13 @@ abstract class TablePager extends IndexPager { * @return Associative array */ function getRowAttrs( $row ) { - return array( 'class' => $this->getRowClass( $row ) ); + $class = $this->getRowClass( $row ); + if ( $class === '' ) { + // Return an empty array to avoid clutter in HTML like class="" + return array(); + } else { + return array( 'class' => $this->getRowClass( $row ) ); + } } /**