Fix bug in HTMLForm where password fields only got the type="password" attribute...
authorHappy-melon <happy-melon@users.mediawiki.org>
Sat, 26 Sep 2009 11:20:25 +0000 (11:20 +0000)
committerHappy-melon <happy-melon@users.mediawiki.org>
Sat, 26 Sep 2009 11:20:25 +0000 (11:20 +0000)
RELEASE-NOTES
includes/HTMLForm.php

index d7b2c28..ff4f76a 100644 (file)
@@ -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
 * (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 ==
 
 
 == API changes in 1.16 ==
 
index ca5121e..2abe7da 100644 (file)
@@ -572,22 +572,32 @@ class HTMLTextField extends HTMLFormField {
                                        $attribs[$param] = '';
                                }
                        }
                                        $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'] ) {
                                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;
                                case 'password':
                                        $attribs['type'] = 'password';
                                        break;
-                               }
                        }
                }
 
                        }
                }