From e71ffbd5bad3a84c3659c7be6ff71e3b4d81410a Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Tue, 15 Dec 2009 00:11:47 +0000 Subject: [PATCH] maxlength=200 for page move summary in HTML5 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 | 1 + includes/Html.php | 3 +++ includes/specials/SpecialMovepage.php | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 52d64103ec..8e87f7ae63 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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, diff --git a/includes/Html.php b/includes/Html.php index 8b9e50e799..c7476f2252 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -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', diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index 15e155be18..1bf1d48923 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -218,7 +218,8 @@ class MovePageForm { Xml::label( wfMsg( 'movereason' ), 'wpReason' ) . " " . - 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 ) . " " ); -- 2.20.1