r67975 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67974‎ | r67975 | r67976 >
Date:02:01, 14 June 2010
Author:tstarling
Status:deferred
Tags:
Comment:
MFT r67283, r67869 (bug 23769): disable HTML 5 form validation attributes
Modified paths:
  • /branches/wmf/1.16wmf4/includes/Html.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/includes/Html.php
@@ -168,22 +168,6 @@
169169 if ( $element == 'textarea' && isset( $attribs['maxlength'] ) ) {
170170 unset( $attribs['maxlength'] );
171171 }
172 - # Here we're blacklisting some HTML5-only attributes...
173 - $html5attribs = array(
174 - 'autocomplete',
175 - 'autofocus',
176 - 'max',
177 - 'min',
178 - 'multiple',
179 - 'pattern',
180 - 'placeholder',
181 - 'required',
182 - 'step',
183 - 'spellcheck',
184 - );
185 - foreach ( $html5attribs as $badAttr ) {
186 - unset( $attribs[$badAttr] );
187 - }
188172 }
189173
190174 return "<$element" . self::expandAttributes(
@@ -329,6 +313,32 @@
330314 # and we'd like consistency and better compression anyway.
331315 $key = strtolower( $key );
332316
 317+ # Bug 23769: Blacklist all form validation attributes for now. Current
 318+ # (June 2010) WebKit has no UI, so the form just refuses to submit
 319+ # without telling the user why, which is much worse than failing
 320+ # server-side validation. Opera is the only other implementation at
 321+ # this time, and has ugly UI, so just kill the feature entirely until
 322+ # we have at least one good implementation.
 323+ if ( in_array( $key, array( 'max', 'min', 'pattern', 'required', 'step' ) ) ) {
 324+ continue;
 325+ }
 326+
 327+ # Here we're blacklisting some HTML5-only attributes...
 328+ if ( !$wgHtml5 && in_array( $key, array(
 329+ 'autocomplete',
 330+ 'autofocus',
 331+ 'max',
 332+ 'min',
 333+ 'multiple',
 334+ 'pattern',
 335+ 'placeholder',
 336+ 'required',
 337+ 'step',
 338+ 'spellcheck',
 339+ ) ) ) {
 340+ continue;
 341+ }
 342+
333343 # See the "Attributes" section in the HTML syntax part of HTML5,
334344 # 9.1.2.3 as of 2009-08-10. Most attributes can have quotation
335345 # marks omitted, but not all. (Although a literal " is not
Property changes on: branches/wmf/1.16wmf4/includes/Html.php
___________________________________________________________________
Name: svn:mergeinfo
336346 + /branches/REL1_15/phase3/includes/Html.php:51646
/branches/sqlite/includes/Html.php:58211-58321
/branches/wmf-deployment/includes/Html.php:53381,60970
/trunk/phase3/includes/Html.php:63549,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816,67283,67869

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r67283(bug 23769) Disable HTML5 form validation for now...simetrical17:18, 3 June 2010
r67284Backport r67283: (bug 23769) Disable HTML5 form validation for now...simetrical17:22, 3 June 2010
r67869Don't allow boolean HTML5 attribs into XHTML1...simetrical21:57, 11 June 2010

Status & tagging log