r52380 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52379‎ | r52380 | r52381 >
Date:00:00, 25 June 2009
Author:demon
Status:ok (Comments)
Tags:
Comment:
Followup to r52379: Also remove var declarations.
Modified paths:
  • /trunk/phase3/includes/Skin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Skin.php
@@ -333,14 +333,21 @@
334334 static function makeVariablesScript( $data ) {
335335 global $wgJsMimeType;
336336
337 - $r = array( "<script type=\"$wgJsMimeType\">/*<![CDATA[*/" );
 337+ $doneFirstVar = false;
 338+ $r = array( "<script type=\"$wgJsMimeType\">/*<![CDATA[*/\n" );
338339 foreach ( $data as $name => $value ) {
339340 $encValue = Xml::encodeJsVar( $value );
340 - $r[] = "var $name = $encValue;";
 341+ if ( $doneFirstVar )
 342+ $r[] = ",\n$name=$encValue";
 343+ else {
 344+ $r[] = "var $name=$encValue";
 345+ $doneFirstVar = true;
 346+ }
341347 }
342 - $r[] = "/*]]>*/</script>\n";
 348+ # No need for ; since the script is terminating
 349+ $r[] = "\n/*]]>*/</script>\n";
343350
344 - return implode( "\n", $r );
 351+ return implode( $r );
345352 }
346353
347354 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r52379(bug 19382) Remove useless tabs from header variables. Patch by GreenReaper.demon23:28, 24 June 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   00:34, 24 August 2009

Note this was accidentally reverted by the big branch merge in r53282, but was later reimplemented. :)

Status & tagging log