Gerrit Patch Uploader has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/280938

Change subject: Simplify autocomplete attribute in HTMLForm
......................................................................

Simplify autocomplete attribute in HTMLForm

Just use the boolean values instead of boolean and string values.

Follows-up 7489a3e8

Change-Id: Ifb17c88e39df7031054b3bee83772172c64d0a6b
---
M includes/Preferences.php
M includes/htmlform/HTMLForm.php
2 files changed, 11 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/38/280938/1

diff --git a/includes/Preferences.php b/includes/Preferences.php
index 66a8152..dccea3e 100644
--- a/includes/Preferences.php
+++ b/includes/Preferences.php
@@ -1301,7 +1301,7 @@
 
                $htmlForm->setModifiedUser( $user );
                $htmlForm->setId( 'mw-prefs-form' );
-               $htmlForm->setAutocomplete( 'off' );
+               $htmlForm->setAutocomplete( false );
                $htmlForm->setSubmitText( $context->msg( 'saveprefs' )->text() 
);
                # Used message keys: 'accesskey-preferences-save', 
'tooltip-preferences-save'
                $htmlForm->setSubmitTooltip( 'preferences-save' );
diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php
index 25e7f8c..da6d584 100644
--- a/includes/htmlform/HTMLForm.php
+++ b/includes/htmlform/HTMLForm.php
@@ -200,11 +200,13 @@
        protected $mAction = false;
 
        /**
-        * Form attribute autocomplete. false does not set the attribute
+        * Form attribute autocomplete.
+        * true does not set the attribute, because this is the HTML5 default
+        * false set the attribute to autocomplete="off"
         * @since 1.27
-        * @var bool|string
+        * @var bool
         */
-       protected $mAutocomplete = false;
+       protected $mAutocomplete = true;
 
        protected $mUseMultipart = false;
        protected $mHiddenFields = [];
@@ -1004,8 +1006,8 @@
                if ( !empty( $this->mId ) ) {
                        $attribs['id'] = $this->mId;
                }
-               if ( !empty( $this->mAutocomplete ) ) {
-                       $attribs['autocomplete'] = $this->mAutocomplete;
+               if ( $this->mAutocomplete === false ) {
+                       $attribs['autocomplete'] = 'off';
                }
                if ( !empty ( $this->mName ) ) {
                        $attribs['name'] = $this->mName;
@@ -1704,11 +1706,12 @@
 
        /**
         * Set the value for the autocomplete attribute of the form.
-        * When set to false (which is the default state), the attribute get 
not set.
+        * When set to true (which is the default state), the attribute get not 
set.
+        * When set to false the attribute autocomplete="off" get set.
         *
         * @since 1.27
         *
-        * @param string|bool $autocomplete
+        * @param bool $autocomplete
         *
         * @return HTMLForm $this for chaining calls
         */

-- 
To view, visit https://gerrit.wikimedia.org/r/280938
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb17c88e39df7031054b3bee83772172c64d0a6b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <gerritpatchuploa...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to