r81571 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81570‎ | r81571 | r81572 >
Date:20:28, 5 February 2011
Author:dantman
Status:ok (Comments)
Tags:
Comment:
Html::expandAttributes( array( 'foo' => null ) ); ' foo=""' -> ''
Outputting ' foo="" on `foo = null` promotes the writing of overly verbose code to avoid it, and ugly methods like our old Linker::getLinkAttributesInternal, both of which are completely counter to the purpose of Html::.
Modified paths:
  • /trunk/phase3/includes/Html.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Html.php
@@ -352,7 +352,7 @@
353353 $ret = '';
354354 $attribs = (array)$attribs;
355355 foreach ( $attribs as $key => $value ) {
356 - if ( $value === false ) {
 356+ if ( $value === false || is_null( $value ) ) {
357357 continue;
358358 }
359359

Follow-up revisions

RevisionCommit summaryAuthorDate
r91419tests for Html::testExpandAttributes()...hashar19:51, 4 July 2011

Comments

#Comment by Hashar (talk | contribs)   08:11, 3 June 2011

Might use some PHPUnit tests cases -> +'write-test'

#Comment by Hashar (talk | contribs)   19:52, 4 July 2011

Some tests added with r91419

#Comment by Hashar (talk | contribs)   09:43, 24 October 2011

removing tag 'needs-php-test' since I have added tests.

Status & tagging log