maxlength=200 for page move summary in HTML5
authorAryeh Gregor <simetrical@users.mediawiki.org>
Tue, 15 Dec 2009 00:11:47 +0000 (00:11 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Tue, 15 Dec 2009 00:11:47 +0000 (00:11 +0000)
Bug 16921.  maxlength is not allowed on textareas in HTML4, so this only
works in HTML5.  Note that Firefox 3.5 and Opera 9.22 ignore the
attribute (didn't test IE), so this isn't a complete fix.  Recent WebKit
does respect the attribute (tested in Chrome 4).

Of course, the length limit of 200 is a hack, just like for edit
summaries, and we really need to move to a non-varchar(255) backend for
all these fields.

Relevant to r45517, r45571.

RELEASE-NOTES
includes/Html.php
includes/specials/SpecialMovepage.php

index 52d6410..8e87f7a 100644 (file)
@@ -218,6 +218,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 ** Unnecessary type="" attribute removed for CSS and JS.
 ** If $wgWellFormedXml is set to false, some bytes will be shaved off of HTML
    output by omitting some things like quotation marks where HTML 5 allows.
+** (bug 16921) maxlength enabled for page move comments
 * The description message in $wgExtensionCredits can be an array with parameters
 * New hook SpecialRandomGetRandomTitle allows extensions to modify the selection
   criteria used by Special:Random and subclasses, or substitute a custom result,
index 8b9e50e..c7476f2 100644 (file)
@@ -134,6 +134,9 @@ class Html {
                                        unset( $attribs['type'] );
                                }
                        }
+                       if ( $element == 'textarea' && isset( $attribs['maxlength'] ) ) {
+                               unset( $attribs['maxlength'] );
+                       }
                        # Here we're blacklisting some HTML5-only attributes...
                        $html5attribs = array(
                                'autocomplete',
index 15e155b..1bf1d48 100644 (file)
@@ -218,7 +218,8 @@ class MovePageForm {
                                        Xml::label( wfMsg( 'movereason' ), 'wpReason' ) .
                                "</td>
                                <td class='mw-input'>" .
-                                       Xml::tags( 'textarea', array( 'name' => 'wpReason', 'id' => 'wpReason', 'cols' => 60, 'rows' => 2 ), htmlspecialchars( $this->reason ) ) .
+                                       Html::element( 'textarea', array( 'name' => 'wpReason', 'id' => 'wpReason', 'cols' => 60, 'rows' => 2,
+                                       'maxlength' => 200 ), $this->reason ) .
                                "</td>
                        </tr>"
                );