diff --git a/libraries/src/HTML/HTMLHelper.php b/libraries/src/HTML/HTMLHelper.php
index 25db7e6fc5352..03cdfda8e282c 100644
--- a/libraries/src/HTML/HTMLHelper.php
+++ b/libraries/src/HTML/HTMLHelper.php
@@ -799,26 +799,19 @@ public static function webcomponent(string $file, array $options = [])
}
}
- if (count($includes) === 1)
+ foreach ($includes as $include)
{
- $potential = $includes[0] . ((strpos($includes[0], '?') === false) ? $version : '');
+ $potential = $include . ((strpos($include, '?') === false) ? $version : '');
+ $components = Factory::getDocument()->getScriptOptions('webcomponents');
- if (!in_array($potential, Factory::getDocument()->getScriptOptions('webcomponents')))
+ if (in_array($potential, $components))
{
- Factory::getDocument()->addScriptOptions('webcomponents', [$potential]);
- return;
+ continue;
}
- return;
- }
-
- $potential = $includes . ((strpos($includes, '?') === false) ? $version : '');
-
- if (!in_array($potential, Factory::getDocument()->getScriptOptions('webcomponents')))
- {
- Factory::getDocument()->addScriptOptions('webcomponents', [$potential]);
+ $components[] = $potential;
+ Factory::getDocument()->addScriptOptions('webcomponents', $components);
}
-
}
/**