Merge "LivePreview: Prevent unnecessary DOM change for spinner"
[lhc/web/wiklou.git] / includes / htmlform / HTMLTextField.php
index 2958274..157116d 100644 (file)
@@ -5,6 +5,15 @@ class HTMLTextField extends HTMLFormField {
                return isset( $this->mParams['size'] ) ? $this->mParams['size'] : 45;
        }
 
+       function getSpellCheck() {
+               $val = isset( $this->mParams['spellcheck'] ) ? $this->mParams['spellcheck'] : null;
+               if ( is_bool( $val ) ) {
+                       // "spellcheck" attribute literally requires "true" or "false" to work.
+                       return $val === true ? 'true' : 'false';
+               }
+               return null;
+       }
+
        function getInputHTML( $value ) {
                $attribs = array(
                                'id' => $this->mID,
@@ -12,6 +21,7 @@ class HTMLTextField extends HTMLFormField {
                                'size' => $this->getSize(),
                                'value' => $value,
                                'dir' => $this->mDir,
+                               'spellcheck' => $this->getSpellCheck(),
                        ) + $this->getTooltipAndAccessKey();
 
                if ( $this->mClass !== '' ) {
@@ -105,11 +115,15 @@ class HTMLTextField extends HTMLFormField {
 
                $type = $this->getType( $attribs );
 
-               return new OOUI\TextInputWidget( array(
+               return $this->getInputWidget( array(
                        'id' => $this->mID,
                        'name' => $this->mName,
                        'value' => $value,
                        'type' => $type,
                ) + $attribs );
        }
+
+       protected function getInputWidget( $params ) {
+               return new OOUI\TextInputWidget( $params );
+       }
 }