From c1e148b1b09ebf45b202351b79ef19f891e2bd0f Mon Sep 17 00:00:00 2001 From: Sartxi Date: Tue, 29 Oct 2024 12:42:41 -0600 Subject: [PATCH] reduce queries and remove uneeded mapping --- libs/blocks/table/table.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libs/blocks/table/table.js b/libs/blocks/table/table.js index e5309fc26e..ab0d1ce3da 100644 --- a/libs/blocks/table/table.js +++ b/libs/blocks/table/table.js @@ -137,12 +137,10 @@ function handleAddOnContent(table) { const tagName = `${position}-${order}`; const column = [...addOnRow.children].find((el) => el.getAttribute(dataIndex) === colIndex); let content = column.childNodes; - if (style === 'label' && column.querySelector('.icon')) { - const textContent = [...content].filter((node) => !node.classList?.contains('icon')); - content = [ - createTag('span', null, textContent.map((node) => node)), - column.querySelector('.icon'), - ]; + const icon = column.querySelector('.icon'); + if (style === 'label' && icon) { + const text = [...content].filter((node) => !node.classList?.contains('icon')); + content = [createTag('span', null, text), icon]; } const tag = createTag('div', { class: tagName }, [...content].map((node) => node)); if (style) tag.classList.add(`addon-${style}`);