(bug 23769) Disable HTML5 form validation for now
authorAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 3 Jun 2010 17:18:21 +0000 (17:18 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 3 Jun 2010 17:18:21 +0000 (17:18 +0000)
Is implemented in recent WebKit but with no UI, so it's worse than just
giving a server-side error.  The only other implementation right now is
Opera and its UI is pretty ugly, so not yet worth the effort to do UA
sniffing.  Will backport to 1.16, as a regression fix.

HISTORY
includes/Html.php

diff --git a/HISTORY b/HISTORY
index 65e66f4..0ec09c0 100644 (file)
--- a/HISTORY
+++ b/HISTORY
@@ -192,10 +192,7 @@ Change notes from older releases. For current info see RELEASE-NOTES.
 * The default output format is now HTML 5 instead of XHTML 1.0 Transitional.
   This can be disabled by setting $wgHtml5 = false;.  Specific features enabled
   if HTML 5 is used:
-** New HTML 5 input attributes allow JavaScript-free input validation in some
-   cutting-edge browsers.  E.g., some inputs will be autofocused, users will
-   not be allowed to submit forms with certain types of invalid values (like
-   numbers outside the permitted ranges), etc.
+** Some extra inputs will be autofocused, in supporting browsers.
 ** The summary attribute has been removed from tables of contents.  summary is
    obsolete in HTML 5 and wasn't useful here anyway.
 ** Unnecessary type="" attribute removed for CSS and JS.
index 6a69b9c..ccd1787 100644 (file)
@@ -370,6 +370,16 @@ class Html {
                        # and we'd like consistency and better compression anyway.
                        $key = strtolower( $key );
 
+                       # Bug 23769: Blacklist all form validation attributes for now.  Current
+                       # (June 2010) WebKit has no UI, so the form just refuses to submit
+                       # without telling the user why, which is much worse than failing
+                       # server-side validation.  Opera is the only other implementation at
+                       # this time, and has ugly UI, so just kill the feature entirely until
+                       # we have at least one good implementation.
+                       if ( in_array( $key, array( 'max', 'min', 'pattern', 'required', 'step' ) ) ) {
+                               continue;
+                       }
+
                        # See the "Attributes" section in the HTML syntax part of HTML5,
                        # 9.1.2.3 as of 2009-08-10.  Most attributes can have quotation
                        # marks omitted, but not all.  (Although a literal " is not