From d950da075dcb6c6dd3f68a50a0d427569350763a Mon Sep 17 00:00:00 2001 From: Matthew Flaschen Date: Thu, 7 Aug 2014 12:09:06 -0400 Subject: [PATCH] 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 --- includes/Html.php | 17 ----------------- 1 file changed, 17 deletions(-) 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 ""; } -- 2.20.1