summaryrefslogtreecommitdiffstats
path: root/core/lib/Drupal/Core/Render
diff options
context:
space:
mode:
authorNathaniel Catchpole2017-11-13 13:35:04 (GMT)
committerNathaniel Catchpole2017-11-13 13:35:04 (GMT)
commitffa979ba1c6580b1db6b99c291a496e2c21a2b89 (patch)
treee6f8ea206079b58b10c5ceb569b8311fb5fc2831 /core/lib/Drupal/Core/Render
parent623461231beff5038f72aacacf20cca4ccd1e564 (diff)
Issue #2563069 by DuaelFr, ecarty, idebr: Unclosed conditional comments in html tag result in broken html head
Diffstat (limited to 'core/lib/Drupal/Core/Render')
-rw-r--r--core/lib/Drupal/Core/Render/Element/HtmlTag.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/lib/Drupal/Core/Render/Element/HtmlTag.php b/core/lib/Drupal/Core/Render/Element/HtmlTag.php
index 2413784..98cf636 100644
--- a/core/lib/Drupal/Core/Render/Element/HtmlTag.php
+++ b/core/lib/Drupal/Core/Render/Element/HtmlTag.php
@@ -87,19 +87,19 @@ class HtmlTag extends RenderElement {
$escaped_tag = HtmlUtility::escape($element['#tag']);
$open_tag = '<' . $escaped_tag . $attributes;
$close_tag = '</' . $escaped_tag . ">\n";
- $prefix = isset($element['#prefix']) ? $element['#prefix'] . $open_tag : $open_tag;
- $suffix = isset($element['#suffix']) ? $close_tag . $element['#suffix'] : $close_tag;
// Construct a void element.
if (in_array($element['#tag'], self::$voidElements)) {
- $prefix .= " />\n";
- $suffix = '';
+ $open_tag .= ' />';
+ $close_tag = "\n";
}
// Construct all other elements.
else {
- $prefix .= '>';
+ $open_tag .= '>';
$markup = $element['#value'] instanceof MarkupInterface ? $element['#value'] : Xss::filterAdmin($element['#value']);
$element['#markup'] = Markup::create($markup);
}
+ $prefix = isset($element['#prefix']) ? $element['#prefix'] . $open_tag : $open_tag;
+ $suffix = isset($element['#suffix']) ? $close_tag . $element['#suffix'] : $close_tag;
if (!empty($element['#noscript'])) {
$prefix = '<noscript>' . $prefix;
$suffix .= '</noscript>';