Add 'list' to allowed input attributes in HTMLForm
authorrobin <robinp.1273@gmail.com>
Sat, 18 Aug 2012 01:32:51 +0000 (03:32 +0200)
committerrobin <robinp.1273@gmail.com>
Sat, 18 Aug 2012 01:32:51 +0000 (03:32 +0200)
Add 'list' (new in HTML5 as part of datalist) to the allowed input attributes in HTMLForm.
Also move maxlength into the general foreach.

Change-Id: I2ba61b0cc1b9f8b3db6c419efb5cbadfde594699

includes/HTMLForm.php

index e617f17..db29436 100644 (file)
@@ -1527,18 +1527,15 @@ class HTMLTextField extends HTMLFormField {
                        $attribs['class'] = $this->mClass;
                }
 
-               if ( isset( $this->mParams['maxlength'] ) ) {
-                       $attribs['maxlength'] = $this->mParams['maxlength'];
-               }
-
                if ( !empty( $this->mParams['disabled'] ) ) {
                        $attribs['disabled'] = 'disabled';
                }
 
                # TODO: Enforce pattern, step, required, readonly on the server side as
                # well
-               foreach ( array( 'min', 'max', 'pattern', 'title', 'step',
-               'placeholder' ) as $param ) {
+               $allowedParams = array( 'min', 'max', 'pattern', 'title', 'step',
+                       'placeholder', 'list', 'maxlength' );
+               foreach ( $allowedParams as $param ) {
                        if ( isset( $this->mParams[$param] ) ) {
                                $attribs[$param] = $this->mParams[$param];
                        }