diff --git a/libraries/src/Document/HtmlDocument.php b/libraries/src/Document/HtmlDocument.php
index becac5bff1ef0..124383644b7d0 100644
--- a/libraries/src/Document/HtmlDocument.php
+++ b/libraries/src/Document/HtmlDocument.php
@@ -309,7 +309,7 @@ public function mergeHeadData($data)
{
foreach ($data['style'] as $type => $stdata)
{
- if (!isset($this->_style[strtolower($type)]) || !stristr($this->_style[strtolower($type)], $stdata))
+ if (!isset($this->_style[strtolower($type)]) || !stristr($stdata, $this->_style[strtolower($type)]))
{
$this->addStyleDeclaration($stdata, $type);
}
@@ -324,7 +324,7 @@ public function mergeHeadData($data)
{
foreach ($data['script'] as $type => $sdata)
{
- if (!isset($this->_script[strtolower($type)]) || !stristr($this->_script[strtolower($type)], $sdata))
+ if (!isset($this->_script[strtolower($type)]) || !stristr($sdata, $this->_script[strtolower($type)]))
{
$this->addScriptDeclaration($sdata, $type);
}