);
if ( $res->numRows() > 0 ) {
- $out = Html::openElement( 'div', array( 'class' => 'mw-allpages-body' ) );
- $out .= Html::openElement( 'ul', array( 'class' => 'mw-allpages-chunk' ) );
+ $out = Html::openElement( 'ul', array( 'class' => 'mw-allpages-chunk' ) );
while ( ( $n < $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
$t = Title::newFromRow( $s );
$n++;
}
$out .= Html::closeElement( 'ul' );
- $out .= Html::closeElement( 'div' );
+
+ if ( $res->numRows() > 2 ) {
+ // Only apply CSS column styles if there's more than 2 entries.
+ // Otherwise, rendering is broken as "mw-allpages-body"'s CSS column count is 3.
+ $out = Html::rawElement( 'div', array( 'class' => 'mw-allpages-body' ), $out );
+ }
} else {
$out = '';
}
$n = 0;
if ( $res->numRows() > 0 ) {
- $out = Html::openElement( 'div', array( 'class' => 'mw-prefixindex-body' ) );
- $out .= Html::openElement( 'ul', array( 'class' => 'mw-prefixindex-list' ) );
+ $out = Html::openElement( 'ul', array( 'class' => 'mw-prefixindex-list' ) );
$prefixLength = strlen( $prefix );
while ( ( $n < $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
$link = '[[' . htmlspecialchars( $s->page_title ) . ']]';
}
- $out .= "<li> $link </li>\n";
+ $out .= "<li>$link</li>\n";
$n++;
}
$out .= Html::closeElement( 'ul' );
- $out .= Html::closeElement( 'div' );
+
+ if ( $res->numRows() > 2 ) {
+ // Only apply CSS column styles if there's more than 2 entries.
+ // Otherwise rendering is broken as "mw-prefixindex-body"'s CSS column count is 3.
+ $out = Html::rawElement( 'div', array( 'class' => 'mw-prefixindex-body' ), $out );
+ }
} else {
$out = '';
}
!! wikitext
{{Special:Prefixindex/Xyzzyx}}
!! html
-<div class="mw-prefixindex-body"><ul class="mw-prefixindex-list"><li> <a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a> </li>
-</ul></div>
+<ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
+</ul>
!! end
{{Special:Prefixindex/Xyzzyx}}
{{Special:Prefixindex/Xyzzyx}}
!! html
-<div class="mw-prefixindex-body"><ul class="mw-prefixindex-list"><li> <a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a> </li>
-</ul></div>
-<div class="mw-prefixindex-body"><ul class="mw-prefixindex-list"><li> <a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a> </li>
-</ul></div>
+<ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
+</ul>
+<ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
+</ul>
!! end