From b4913d5b969543cc3bfd3653c12eaee7ea6c409b Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Mon, 24 Oct 2011 13:58:03 +0000 Subject: [PATCH] makes HTML5 five only attributes a global property This patch move an array hidden in Html::expandAttributes() to the top of the class definition as self::$HTMLFiveOnlyAttribs. That also make the Html::expandAttributes() method a bit more concise. --- includes/Html.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/includes/Html.php b/includes/Html.php index e778c72ee7..fb3f16789a 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -101,6 +101,19 @@ class Html { 'itemscope', ); + private static $HTMLFiveOnlyAttribs = array( + 'autocomplete', + 'autofocus', + 'max', + 'min', + 'multiple', + 'pattern', + 'placeholder', + 'required', + 'step', + 'spellcheck', + ); + /** * Returns an HTML element in a string. The major advantage here over * manually typing out the HTML is that it will escape all attribute @@ -408,18 +421,8 @@ class Html { $key = strtolower( $key ); # Here we're blacklisting some HTML5-only attributes... - if ( !$wgHtml5 && in_array( $key, array( - 'autocomplete', - 'autofocus', - 'max', - 'min', - 'multiple', - 'pattern', - 'placeholder', - 'required', - 'step', - 'spellcheck', - ) ) ) { + if ( !$wgHtml5 && in_array( $key, self::$HTMLFiveOnlyAttribs ) + ) { continue; } -- 2.20.1