From 5e74a2007c8693cfd15dade3def4015824ebd3d0 Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Fri, 18 Feb 2011 15:14:08 +0000 Subject: [PATCH] Follow-up r82391 per Nikerabbit's CR: Fix it in a better way --- includes/Pager.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) 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 ) ); + } } /** -- 2.20.1