From 6430d85ed641d6ecaef7ec1d363d4e6e89a28225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Grabowski?= Date: Wed, 23 Nov 2022 11:53:00 +0100 Subject: [PATCH] fixes after cr --- .../public/js/scripts/helpers/middle.ellipsis.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/bundle/Resources/public/js/scripts/helpers/middle.ellipsis.js b/src/bundle/Resources/public/js/scripts/helpers/middle.ellipsis.js index d0f1206efa..8e0876233a 100644 --- a/src/bundle/Resources/public/js/scripts/helpers/middle.ellipsis.js +++ b/src/bundle/Resources/public/js/scripts/helpers/middle.ellipsis.js @@ -1,12 +1,14 @@ (function (global, doc, ibexa) { const resizeEllipsisObserver = new ResizeObserver((entries) => { entries.forEach((entry) => { - parseAll(entry.target); + parse(entry.target); }); }); const parse = (baseElement = doc) => { - if (!baseElement) { - console.warn('No baseElement provided'); + const isHTMLElement = baseElement instanceof Element || baseElement instanceof Document; + + if (!isHTMLElement) { + console.warn('Provided element does not belong to Document interface'); return; } @@ -36,10 +38,11 @@ contentElements.forEach((contentElement) => { contentElement.innerHTML = contentEscaped; }); - parseAll(baseElement); + parse(baseElement); }; ibexa.addConfig('helpers.ellipsis.middle', { + parse, parseAll, update, });