Don't drop default attrib values in non-HTML5
authorAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 18 Sep 2009 14:19:34 +0000 (14:19 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 18 Sep 2009 14:19:34 +0000 (14:19 +0000)
Some attributes that have defaults in HTML5 don't have defaults in
XHTML1, particularly type="" on scripts and styles (bug 20713).  There's
not much point in trying to maintain two separate sets of defaults,
so I've just kept the HTML5 ones and haven't tried to strip any defaults
in XHTML1 mode.

includes/Html.php

index a841d83..8aa1de6 100644 (file)
@@ -195,6 +195,13 @@ class Html {
         * @return array An array of attributes functionally identical to $attribs
         */
        private static function dropDefaults( $element, $attribs ) {
+               # Don't bother doing anything if we aren't outputting HTML5; it's too
+               # much of a pain to maintain two sets of defaults.
+               global $wgHtml5;
+               if ( !$wgHtml5 ) {
+                       return $attribs;
+               }
+
                static $attribDefaults = array(
                        'area' => array( 'shape' => 'rect' ),
                        'button' => array(