From: Happy-melon Date: Sat, 26 Sep 2009 11:20:25 +0000 (+0000) Subject: Fix bug in HTMLForm where password fields only got the type="password" attribute... X-Git-Tag: 1.31.0-rc.0~39517 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=6fce8771f7077f58547a923a686252b9043392d3;p=lhc%2Fweb%2Fwiklou.git Fix bug in HTMLForm where password fields only got the type="password" attribute if $wgHtml5 = true. Prompted by r56937. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d7b2c28609..ff4f76a211 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -538,6 +538,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 3421) Live preview no longer breaks user CSS/JS previews * (bug 11264) The file logo on a file description page for documents (PDF, ...) now links to the file rather than the file description page +* Password fields built with HTMLForm now still have the type="password" attribute + if $wgHtml5=false. == API changes in 1.16 == diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index ca5121e519..2abe7dadaa 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -572,22 +572,32 @@ class HTMLTextField extends HTMLFormField { $attribs[$param] = ''; } } - if ( isset( $this->mParams['type'] ) ) { + } + + # Implement tiny differences between some field variants + # here, rather than creating a new class for each one which + # is essentially just a clone of this one. + if ( isset( $this->mParams['type'] ) ) { + # Options that apply only to HTML5 + if( $wgHtml5 ){ switch ( $this->mParams['type'] ) { - case 'email': - $attribs['type'] = 'email'; - break; - case 'int': - $attribs['type'] = 'number'; - break; - case 'float': - $attribs['type'] = 'number'; - $attribs['step'] = 'any'; - break; + case 'email': + $attribs['type'] = 'email'; + break; + case 'int': + $attribs['type'] = 'number'; + break; + case 'float': + $attribs['type'] = 'number'; + $attribs['step'] = 'any'; + break; + } + } + # Options that apply to HTML4 as well + switch( $this->mParams['type'] ){ case 'password': $attribs['type'] = 'password'; break; - } } }