The code didn't handle the case where a non-associative array was passed
for the attributes, like array( 'autofocus' ) instead of array(
'autofocus' => '' ). In retrospect, allowing this syntax was a bad
decision and I wish I hadn't. Associative arrays shouldn't pretend to
be lists. Probably too much trouble to change it now.
if ( $element == 'textarea' && isset( $attribs['maxlength'] ) ) {
unset( $attribs['maxlength'] );
}
- # 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] );
- }
}
return "<$element" . self::expandAttributes(
continue;
}
+ # Here we're blacklisting some HTML5-only attributes...
+ if ( !$wgHtml5 && in_array( $key, array(
+ 'autocomplete',
+ 'autofocus',
+ 'max',
+ 'min',
+ 'multiple',
+ 'pattern',
+ 'placeholder',
+ 'required',
+ 'step',
+ 'spellcheck',
+ ) ) ) {
+ 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