From: Aryeh Gregor Date: Fri, 11 Dec 2009 19:01:16 +0000 (+0000) Subject: Fix bugs in r59360, r59361, r59363 X-Git-Tag: 1.31.0-rc.0~38568 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=5d768de96e28b35970fc8e343e67bf3994aa20bb;p=lhc%2Fweb%2Fwiklou.git Fix bugs in r59360, r59361, r59363 * spellcheck is not a boolean attribute; it is an enumerated attribute whose possible values are "true" and "false". If it were boolean, the permitted constructs would be , , and , which would all set it true, and it would only be set to false if omitted entirely. (It would be boolean if HTML5 had invented it, but can't be for historical reasons.) * spellcheck is valid on any HTML element, not just input, and so should be stripped on any element. For reference, a table of all HTML5 attributes can be found at: --- diff --git a/includes/Html.php b/includes/Html.php index 7357eb93fb..8b9e50e799 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -81,7 +81,6 @@ class Html { 'reversed', 'scoped', 'seamless', - 'spellcheck', ); /** @@ -113,13 +112,10 @@ class Html { # consistency and better compression. $element = strtolower( $element ); - # Element-specific hacks to slim down output and ensure validity - if ( $element == 'input' ) { - if ( !$wgHtml5 ) { - # With $wgHtml5 off we want to validate as XHTML 1, so we - # strip out any fancy HTML 5-only input types for now. - # - # Whitelist of valid types: + # Remove HTML5-only attributes if we aren't doing HTML5 + if ( !$wgHtml5 ) { + if ( $element == 'input' ) { + # Whitelist of valid XHTML1 types $validTypes = array( 'hidden', 'text', @@ -137,22 +133,22 @@ class Html { # Fall back to type=text, the default unset( $attribs['type'] ); } - # Here we're blacklisting some HTML5-only attributes... - $html5attribs = array( - 'autocomplete', - 'autofocus', - 'max', - 'min', - 'multiple', - 'pattern', - 'placeholder', - 'required', - 'step', - 'spellcheck', - ); - foreach ( $html5attribs as $badAttr ) { - unset( $attribs[$badAttr] ); - } + } + # Here we're blacklisting some HTML5-only attributes... + $html5attribs = array( + 'autocomplete', + 'autofocus', + 'max', + 'min', + 'multiple', + 'pattern', + 'placeholder', + 'required', + 'step', + 'spellcheck', + ); + foreach ( $html5attribs as $badAttr ) { + unset( $attribs[$badAttr] ); } }