From: Matthew Flaschen Date: Thu, 7 Aug 2014 16:09:06 +0000 (-0400) Subject: Html::closeElement: Don't omit closing tags. X-Git-Tag: 1.31.0-rc.0~14523^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dcompta/operations/modifier.php?a=commitdiff_plain;h=d950da075dcb6c6dd3f68a50a0d427569350763a;p=lhc%2Fweb%2Fwiklou.git Html::closeElement: Don't omit closing tags. Although it's allowed by the HTML Living Standard in particular circumstances, the rules are non-trivial and can not be enforced by this method since it has no context. For example, as of http://web.archive.org/web/20140807160955/http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#optional-tags it says: "A head element's end tag may be omitted if the head element is not immediately followed by a space character or a comment." Html::closeElement has no way of knowing whether there is a space character or comment after the tag. There are similar issues with some other tags (e.g. body). Also, even when the rule should be followed anyway (e.g. lists can only contain li elements), there is evidence of browser issues (bug 52210). Use closing tags for all elements for simplicity. Bug: 52210 Change-Id: I97ce415288300e40c4d0aa0442bdf4ee3dedb30f --- diff --git a/includes/Html.php b/includes/Html.php index ce439cb3ee..9b5ec03574 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -233,25 +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 ""; }