diff --git a/src/Sanitize.php b/src/Sanitize.php index df1176b7..9918a517 100644 --- a/src/Sanitize.php +++ b/src/Sanitize.php @@ -697,7 +697,7 @@ protected function enforce_allowed_html_nodes(\DOMNode $element, bool $allow_dat $parent = $element->parentNode; if (!in_array($tag, ['html', 'head', 'body', 'div'], true) && !isset($this->allowed_html_elements_with_attributes[$tag])) { - if (!in_array($tag, ['script', 'style', 'svg', 'math'], true)) { + if (!in_array($tag, ['script', 'style', 'svg', 'math', 'template'], true)) { // Preserve children inside the disallowed element for ($i = $element->childNodes->length - 1; $i >= 0; $i--) { $child = $element->childNodes->item($i);