Merge "Html::closeElement: Don't omit closing tags."
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 8 Aug 2014 00:43:31 +0000 (00:43 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 8 Aug 2014 00:43:31 +0000 (00:43 +0000)
1  2 
includes/Html.php

diff --combined includes/Html.php
@@@ -36,7 -36,7 +36,7 @@@
   *
   * There are two important configuration options this class uses:
   *
 - * $wgMimeType: If this is set to an xml mimetype then output should be
 + * $wgMimeType: If this is set to an xml MIME type then output should be
   *     valid XHTML5.
   * $wgWellFormedXml: If this is set to true, then all output should be
   *     well-formed XML (quotes on attributes, self-closing tags, etc.).
@@@ -233,25 -233,8 +233,8 @@@ class Html 
         * @return string A closing tag, if required
         */
        public static function closeElement( $element ) {
-               global $wgWellFormedXml;
                $element = strtolower( $element );
  
-               // Reference:
-               // http://www.whatwg.org/html/syntax.html#optional-tags
-               if ( !$wgWellFormedXml && in_array( $element, array(
-                       'html',
-                       'head',
-                       'body',
-                       'li',
-                       'dt',
-                       'dd',
-                       'tr',
-                       'td',
-                       'th',
-               ) ) ) {
-                       return '';
-               }
                return "</$element>";
        }
  
                $isXHTML = self::isXmlMimeType( $wgMimeType );
  
                if ( $isXHTML ) { // XHTML5
 -                      // XML mimetyped markup should have an xml header.
 +                      // XML MIME-typed markup should have an xml header.
                        // However a DOCTYPE is not needed.
                        $ret .= "<?xml version=\"1.0\" encoding=\"UTF-8\" ?" . ">\n";
  
        }
  
        /**
 -       * Determines if the given mime type is xml.
 +       * Determines if the given MIME type is xml.
         *
 -       * @param string $mimetype MimeType
 +       * @param string $mimetype MIME type
         * @return bool
         */
        public static function isXmlMimeType( $mimetype ) {
                # http://www.whatwg.org/html/infrastructure.html#xml-mime-type
                # * text/xml
                # * application/xml
 -              # * Any mimetype with a subtype ending in +xml (this implicitly includes application/xhtml+xml)
 +              # * Any MIME type with a subtype ending in +xml (this implicitly includes application/xhtml+xml)
                return (bool)preg_match( '!^(text|application)/xml$|^.+/.+\+xml$!', $mimetype );
        }