From 125cbd8c017b872c78f047c08f494a458883db23 Mon Sep 17 00:00:00 2001 From: Fomafix Date: Tue, 27 Dec 2016 22:14:16 +0100 Subject: [PATCH] Use \u{00A0} instead of   or   Directly use the UTF-8 encoding of the 'NO-BREAK SPACE' (U+00A0) instead of the HTML/XML entities   or   or  . With the UTF-8 character the generated HTML is shorter and better to read. Also change the special value for the label in HTMLForm from   to U+00A0 but also support   for backward compability. Bug: T154300 Change-Id: I882599ac1120789bb4e524c4394870680caca4f4 --- includes/CategoryViewer.php | 2 +- includes/Html.php | 2 +- includes/Xml.php | 6 +++--- includes/actions/HistoryAction.php | 4 ++-- includes/changes/ChangesList.php | 2 +- includes/changes/EnhancedChangesList.php | 4 ++-- includes/diff/DifferenceEngine.php | 8 ++++---- includes/diff/TableDiffFormatter.php | 10 +++++----- includes/diff/WordAccumulator.php | 2 +- includes/htmlform/HTMLForm.php | 2 +- includes/htmlform/HTMLFormField.php | 20 ++++++++++++------- includes/htmlform/fields/HTMLButtonField.php | 4 ++-- includes/htmlform/fields/HTMLCheckField.php | 4 ++-- includes/htmlform/fields/HTMLCheckMatrix.php | 2 +- .../htmlform/fields/HTMLFormFieldCloner.php | 2 +- .../fields/HTMLFormFieldWithButton.php | 2 +- .../htmlform/fields/HTMLMultiSelectField.php | 2 +- includes/htmlform/fields/HTMLRadioField.php | 2 +- .../htmlform/fields/HTMLSizeFilterField.php | 6 +++--- includes/installer/WebInstaller.php | 4 ++-- includes/installer/WebInstallerOptions.php | 2 +- includes/logging/LogEventsList.php | 2 +- includes/pager/TablePager.php | 4 ++-- includes/specials/SpecialContributions.php | 10 +++++----- includes/specials/SpecialEmailuser.php | 2 +- includes/specials/SpecialMergeHistory.php | 6 +++--- includes/specials/SpecialWatchlist.php | 2 +- includes/specials/SpecialWhatlinkshere.php | 2 +- .../specials/pagers/AllMessagesTablePager.php | 2 +- tests/phpunit/includes/HtmlTest.php | 4 ++-- tests/phpunit/includes/api/ApiOptionsTest.php | 4 ++-- 31 files changed, 68 insertions(+), 62 deletions(-) diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php index 4202249578..79ab8b4463 100644 --- a/includes/CategoryViewer.php +++ b/includes/CategoryViewer.php @@ -581,7 +581,7 @@ class CategoryViewer extends ContextSource { foreach ( $colContents as $char => $articles ) { # Change space to non-breaking space to keep headers aligned - $h3char = $char === ' ' ? ' ' : htmlspecialchars( $char ); + $h3char = $char === ' ' ? "\u{00A0}" : htmlspecialchars( $char ); $ret .= '

' . $h3char; $ret .= "

\n"; diff --git a/includes/Html.php b/includes/Html.php index 2ca52291b5..0016426f54 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -927,7 +927,7 @@ class Html { 'label', [ 'for' => $selectAttribs['id'] ?? null, ], $params['label'] - ) . ' '; + ) . "\u{00A0}"; } // Wrap options in a ' . "\n" . '' . "\n" . '' . "\n" . @@ -359,7 +359,7 @@ class HtmlTest extends MediaWikiTestCase { ); $this->assertEquals( - ' ' . + '' . "\u{00A0}" . '