* Remove trailing space in self-closing tag.
Brings parserTest output of Parser and Parsoid closer together.
* Remove various line breaks at begin and end of script contents.
* Remove FILTER_NOMIN from makeConfigSetScript() output.
This isn't part of any user- or page-dependent module and not minified.
And Xml::encodeJsCall already ensures compact output for prod mode.
Bug: T127328
Change-Id: I85a5a59fd0955c1a112e8b24b933f0d9e983a156
if ( in_array( $element, self::$voidElements ) ) {
if ( $wgWellFormedXml ) {
// Silly XML.
- return substr( $start, 0, -1 ) . ' />';
+ return substr( $start, 0, -1 ) . '/>';
}
return $start;
} else {
* @param string $script Raw HTML
*/
function addScript( $script ) {
- $this->mScripts .= $script . "\n";
+ $this->mScripts .= $script;
}
/**
* @param string $script JavaScript text, no "<script>" tags
*/
public function addInlineScript( $script ) {
- $this->mScripts .= Html::inlineScript( "\n$script\n" ) . "\n";
+ $this->mScripts .= Html::inlineScript( $script );
}
/**
* @return string HTML fragment
*/
function getHeadScripts() {
- return $this->getInlineHeadScripts() . "\n" . $this->getExternalHeadScripts();
+ return $this->getInlineHeadScripts() . $this->getExternalHeadScripts();
}
/**
# If wanted, and the interface is right-to-left, flip the CSS
$style_css = CSSJanus::transform( $style_css, true, false );
}
- $this->mInlineStyles .= Html::inlineStyle( $style_css ) . "\n";
+ $this->mInlineStyles .= Html::inlineStyle( $style_css );
}
/**
if ( $this->getLanguage()->getDir() !== $wgContLang->getDir() ) {
$previewedCSS = CSSJanus::transform( $previewedCSS, true, false );
}
- $otherTags[] = Html::inlineStyle( $previewedCSS ) . "\n";
+ $otherTags[] = Html::inlineStyle( $previewedCSS );
} else {
// Load the user styles normally
$moduleStyles[] = 'user';
ResourceLoaderModule::TYPE_STYLES
);
// Add normal styles added through addStyle()/addInlineStyle() here
- $links[] = implode( "\n", $this->buildCssLinksArray() ) . $this->mInlineStyles;
+ $links[] = implode( '', $this->buildCssLinksArray() ) . $this->mInlineStyles;
// Add marker tag to mark the place where the client-side
// loader should inject dynamic styles
// We use a <meta> tag with a made-up name for this because that's valid HTML
private $logger;
/** @var string JavaScript / CSS pragma to disable minification. **/
- const FILTER_NOMIN = ' /* @nomin */ ';
+ const FILTER_NOMIN = '/*@nomin*/';
/**
* Load information stored in the database about modules.
* @return string
*/
public static function makeLoaderConditionalScript( $script ) {
- return "(window.RLQ = window.RLQ || []).push(function () {\n" .
- trim( $script ) . "\n} );";
+ return '(window.RLQ=window.RLQ||[]).push(function(){' .
+ trim( $script ) . '});';
}
/**
$js = self::makeLoaderConditionalScript( $script );
return new WrappedString(
Html::inlineScript( $js ),
- "<script>(window.RLQ = window.RLQ || []).push(function () {\n",
- "\n} );</script>"
+ '<script>(window.RLQ=window.RLQ||[]).push(function(){',
+ '});</script>'
);
}
'mw.config.set',
[ $configuration ],
ResourceLoader::inDebugMode()
- ) . ResourceLoader::FILTER_NOMIN;
+ );
}
/**
/**
* Generate the JavaScript content of this module.
*
- * Add '@nomin' annotation to prevent the module's contents from getting
- * cached (T84960).
+ * Add FILTER_NOMIN annotation to prevent needless minification and caching (T84960).
*
* @param ResourceLoaderContext $context
* @return string
!! wikitext
External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
!! html
-<p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
+<p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
</p>
!! end
!! wikitext
External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
!! html
-<p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
+<p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
</p>
!! end
!! wikitext
ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
!! html/php
-<p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
+<p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/></a>
</p>
!! html/parsoid
<p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
!! wikitext
http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
!! html
-<p><img src="http://www.example.org/pic.png" alt="pic.png" /> <-- U+3000 (vim: ^Vu3000)
+<p><img src="http://www.example.org/pic.png" alt="pic.png"/> <-- U+3000 (vim: ^Vu3000)
</p>
!! end
$this->setMwGlobals( 'wgWellFormedXml', true );
$this->assertEquals(
- '<img />',
+ '<img/>',
Html::element( 'img', null, '' ),
'Self-closing tag for short-tag elements (wgWellFormedXml = true)'
);
// Load module script only
array(
array( 'test.foo', ResourceLoaderModule::TYPE_SCRIPTS ),
- "<script>(window.RLQ = window.RLQ || []).push(function () {\n"
+ "<script>(window.RLQ=window.RLQ||[]).push(function(){"
. 'mw.loader.load("http://127.0.0.1:8080/w/load.php?debug=false\u0026lang=en\u0026modules=test.foo\u0026only=scripts\u0026skin=fallback");'
- . "\n} );</script>"
+ . "});</script>"
),
array(
// Don't condition wrap raw modules (like the startup module)
// Load private module (only=scripts)
array(
array( 'test.quux', ResourceLoaderModule::TYPE_SCRIPTS ),
- "<script>(window.RLQ = window.RLQ || []).push(function () {\n"
- . "mw.test.baz({token:123});mw.loader.state({\"test.quux\":\"ready\"});\n"
- . "} );</script>"
+ "<script>(window.RLQ=window.RLQ||[]).push(function(){"
+ . "mw.test.baz({token:123});mw.loader.state({\"test.quux\":\"ready\"});"
+ . "});</script>"
),
// Load private module (combined)
array(
array( 'test.quux', ResourceLoaderModule::TYPE_COMBINED ),
- "<script>(window.RLQ = window.RLQ || []).push(function () {\n"
+ "<script>(window.RLQ=window.RLQ||[]).push(function(){"
. "mw.loader.implement(\"test.quux\",function($,jQuery){"
. "mw.test.baz({token:123});},{\"css\":[\".mw-icon{transition:none}"
- . "\"]});\n} );</script>"
+ . "\"]});});</script>"
),
// Load no modules
array(
// Load two modules in separate groups
array(
array( array( 'test.group.foo', 'test.group.bar' ), ResourceLoaderModule::TYPE_COMBINED ),
- "<script>(window.RLQ = window.RLQ || []).push(function () {\n"
+ "<script>(window.RLQ=window.RLQ||[]).push(function(){"
. 'mw.loader.load("http://127.0.0.1:8080/w/load.php?debug=false\u0026lang=en\u0026modules=test.group.bar\u0026skin=fallback");'
- . "\n} );</script>\n"
- . "<script>(window.RLQ = window.RLQ || []).push(function () {\n"
+ . "});</script>\n"
+ . "<script>(window.RLQ=window.RLQ||[]).push(function(){"
. 'mw.loader.load("http://127.0.0.1:8080/w/load.php?debug=false\u0026lang=en\u0026modules=test.group.foo\u0026skin=fallback");'
- . "\n} );</script>"
+ . "});</script>"
),
);
// @codingStandardsIgnoreEnd
$this->assertEquals(
'<label for="year">From year (and earlier):</label> ' .
- '<input id="year" maxlength="4" size="7" type="number" value="2011" name="year" /> ' .
+ '<input id="year" maxlength="4" size="7" type="number" value="2011" name="year"/> ' .
'<label for="month">From month (and earlier):</label> ' .
'<select name="month" id="month" class="mw-month-selector">' .
'<option value="-1">all</option>' . "\n" .
);
$this->assertEquals(
'<label for="year">From year (and earlier):</label> ' .
- '<input id="year" maxlength="4" size="7" type="number" value="2011" name="year" /> ' .
+ '<input id="year" maxlength="4" size="7" type="number" value="2011" name="year"/> ' .
'<label for="month">From month (and earlier):</label> ' .
'<select name="month" id="month" class="mw-month-selector">' .
'<option value="-1">all</option>' . "\n" .
$this->assertEquals(
'<label for="year">From year (and earlier):</label> ' .
- '<input id="year" maxlength="4" size="7" type="number" name="year" /> ' .
+ '<input id="year" maxlength="4" size="7" type="number" name="year"/> ' .
'<label for="month">From month (and earlier):</label> ' .
'<select name="month" id="month" class="mw-month-selector">' .
'<option value="-1">all</option>' . "\n" .