Reduce usage of inline <span style="white-space: nowrap">
authorBartosz Dziewoński <matma.rex@gmail.com>
Thu, 19 Nov 2015 20:34:27 +0000 (21:34 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Thu, 19 Nov 2015 20:38:23 +0000 (21:38 +0100)
Inspired by T119055.

Change-Id: I6829a67fb77c00e87772983f35b884bf03fad7e3

includes/logging/LogEventsList.php
includes/specials/SpecialContributions.php
includes/specials/SpecialProtectedpages.php

index 4c0bd8e..df37610 100644 (file)
@@ -233,7 +233,7 @@ class LogEventsList extends ContextSource {
                        array( 'class' => 'mw-autocomplete-user' )
                );
 
-               return '<span style="white-space: nowrap">' . $label . '</span>';
+               return '<span class="mw-input-with-label">' . $label . '</span>';
        }
 
        /**
@@ -249,7 +249,7 @@ class LogEventsList extends ContextSource {
                        $title
                );
 
-               return '<span style="white-space: nowrap">' . $label .  '</span>';
+               return '<span class="mw-input-with-label">' . $label .  '</span>';
        }
 
        /**
@@ -257,7 +257,7 @@ class LogEventsList extends ContextSource {
         * @return string Checkbox
         */
        private function getTitlePattern( $pattern ) {
-               return '<span style="white-space: nowrap">' .
+               return '<span class="mw-input-with-label">' .
                        Xml::checkLabel( $this->msg( 'log-title-wildcard' )->text(), 'pattern', 'pattern', $pattern ) .
                        '</span>';
        }
index f0a5aa6..81668e1 100644 (file)
@@ -543,7 +543,7 @@ class SpecialContributions extends IncludableSpecialPage {
                        ) . '&#160;' .
                                Html::rawElement(
                                        'span',
-                                       array( 'style' => 'white-space: nowrap' ),
+                                       array( 'class' => 'mw-input-with-label' ),
                                        Xml::checkLabel(
                                                $this->msg( 'invert' )->text(),
                                                'nsInvert',
@@ -555,7 +555,7 @@ class SpecialContributions extends IncludableSpecialPage {
                                                )
                                        ) . '&#160;'
                                ) .
-                               Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
+                               Html::rawElement( 'span', array( 'class' => 'mw-input-with-label' ),
                                        Xml::checkLabel(
                                                $this->msg( 'namespace_association' )->text(),
                                                'associated',
@@ -572,7 +572,7 @@ class SpecialContributions extends IncludableSpecialPage {
                if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) {
                        $deletedOnlyCheck = Html::rawElement(
                                'span',
-                               array( 'style' => 'white-space: nowrap' ),
+                               array( 'class' => 'mw-input-with-label' ),
                                Xml::checkLabel(
                                        $this->msg( 'history-show-deleted' )->text(),
                                        'deletedOnly',
@@ -587,7 +587,7 @@ class SpecialContributions extends IncludableSpecialPage {
 
                $checkLabelTopOnly = Html::rawElement(
                        'span',
-                       array( 'style' => 'white-space: nowrap' ),
+                       array( 'class' => 'mw-input-with-label' ),
                        Xml::checkLabel(
                                $this->msg( 'sp-contributions-toponly' )->text(),
                                'topOnly',
@@ -598,7 +598,7 @@ class SpecialContributions extends IncludableSpecialPage {
                );
                $checkLabelNewOnly = Html::rawElement(
                        'span',
-                       array( 'style' => 'white-space: nowrap' ),
+                       array( 'class' => 'mw-input-with-label' ),
                        Xml::checkLabel(
                                $this->msg( 'sp-contributions-newonly' )->text(),
                                'newOnly',
index 00e56c1..6859310 100644 (file)
@@ -100,17 +100,16 @@ class SpecialProtectedpages extends SpecialPage {
                        Xml::openElement( 'fieldset' ) .
                        Xml::element( 'legend', array(), $this->msg( 'protectedpages' )->text() ) .
                        Html::hidden( 'title', $title->getPrefixedDBkey() ) . "\n" .
-                       $this->getNamespaceMenu( $namespace ) . "&#160;\n" .
-                       $this->getTypeMenu( $type ) . "&#160;\n" .
-                       $this->getLevelMenu( $level ) . "&#160;\n" .
-                       "<br /><span style='white-space: nowrap'>" .
-                       $this->getExpiryCheck( $indefOnly ) . "&#160;\n" .
-                       $this->getCascadeCheck( $cascadeOnly ) . "&#160;\n" .
-                       $this->getRedirectCheck( $noRedirect ) . "&#160;\n" .
-                       "</span><br /><span style='white-space: nowrap'>" .
-                       $this->getSizeLimit( $sizetype, $size ) . "&#160;\n" .
-                       "</span>" .
-                       "&#160;" . Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . "\n" .
+                       $this->getNamespaceMenu( $namespace ) . "\n" .
+                       $this->getTypeMenu( $type ) . "\n" .
+                       $this->getLevelMenu( $level ) . "\n" .
+                       "<br />\n" .
+                       $this->getExpiryCheck( $indefOnly ) . "\n" .
+                       $this->getCascadeCheck( $cascadeOnly ) . "\n" .
+                       $this->getRedirectCheck( $noRedirect ) . "\n" .
+                       "<br />\n" .
+                       $this->getSizeLimit( $sizetype, $size ) . "\n" .
+                       Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . "\n" .
                        Xml::closeElement( 'fieldset' ) .
                        Xml::closeElement( 'form' );
        }
@@ -123,7 +122,7 @@ class SpecialProtectedpages extends SpecialPage {
         * @return string
         */
        protected function getNamespaceMenu( $namespace = null ) {
-               return Html::rawElement( 'span', array( 'style' => 'white-space: nowrap;' ),
+               return Html::rawElement( 'span', array( 'class' => 'mw-input-with-label' ),
                        Html::namespaceSelector(
                                array(
                                        'selected' => $namespace,
@@ -143,12 +142,12 @@ class SpecialProtectedpages extends SpecialPage {
         * @return string Formatted HTML
         */
        protected function getExpiryCheck( $indefOnly ) {
-               return Xml::checkLabel(
+               return '<span class="mw-input-with-label">' . Xml::checkLabel(
                        $this->msg( 'protectedpages-indef' )->text(),
                        'indefonly',
                        'indefonly',
                        $indefOnly
-               ) . "\n";
+               ) . "</span>\n";
        }
 
        /**
@@ -156,12 +155,12 @@ class SpecialProtectedpages extends SpecialPage {
         * @return string Formatted HTML
         */
        protected function getCascadeCheck( $cascadeOnly ) {
-               return Xml::checkLabel(
+               return '<span class="mw-input-with-label">' . Xml::checkLabel(
                        $this->msg( 'protectedpages-cascade' )->text(),
                        'cascadeonly',
                        'cascadeonly',
                        $cascadeOnly
-               ) . "\n";
+               ) . "</span>\n";
        }
 
        /**
@@ -169,12 +168,12 @@ class SpecialProtectedpages extends SpecialPage {
         * @return string Formatted HTML
         */
        protected function getRedirectCheck( $noRedirect ) {
-               return Xml::checkLabel(
+               return '<span class="mw-input-with-label">' . Xml::checkLabel(
                        $this->msg( 'protectedpages-noredirect' )->text(),
                        'noredirect',
                        'noredirect',
                        $noRedirect
-               ) . "\n";
+               ) . "</span>\n";
        }
 
        /**
@@ -185,14 +184,14 @@ class SpecialProtectedpages extends SpecialPage {
        protected function getSizeLimit( $sizetype, $size ) {
                $max = $sizetype === 'max';
 
-               return Xml::radioLabel(
+               return '<span class="mw-input-with-label">' . Xml::radioLabel(
                        $this->msg( 'minimum-size' )->text(),
                        'sizetype',
                        'min',
                        'wpmin',
                        !$max
                ) .
-                       '&#160;' .
+                       ' ' .
                        Xml::radioLabel(
                                $this->msg( 'maximum-size' )->text(),
                                'sizetype',
@@ -200,10 +199,10 @@ class SpecialProtectedpages extends SpecialPage {
                                'wpmax',
                                $max
                        ) .
-                       '&#160;' .
+                       ' ' .
                        Xml::input( 'size', 9, $size, array( 'id' => 'wpsize' ) ) .
-                       '&#160;' .
-                       Xml::label( $this->msg( 'pagesize' )->text(), 'wpsize' );
+                       ' ' .
+                       Xml::label( $this->msg( 'pagesize' )->text(), 'wpsize' ) . "</span>\n";
        }
 
        /**
@@ -228,7 +227,7 @@ class SpecialProtectedpages extends SpecialPage {
                        $options[] = Xml::option( $text, $type, $selected ) . "\n";
                }
 
-               return "<span style='white-space: nowrap'>" .
+               return '<span class="mw-input-with-label">' .
                        Xml::label( $this->msg( 'restriction-type' )->text(), $this->IdType ) . '&#160;' .
                        Xml::tags( 'select',
                                array( 'id' => $this->IdType, 'name' => $this->IdType ),
@@ -260,7 +259,7 @@ class SpecialProtectedpages extends SpecialPage {
                        $options[] = Xml::option( $text, $type, $selected );
                }
 
-               return "<span style='white-space: nowrap'>" .
+               return '<span class="mw-input-with-label">' .
                        Xml::label( $this->msg( 'restriction-level' )->text(), $this->IdLevel ) . ' ' .
                        Xml::tags( 'select',
                                array( 'id' => $this->IdLevel, 'name' => $this->IdLevel ),