Skip to content

Commit

Permalink
reduce queries and remove uneeded mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Sartxi committed Oct 29, 2024
1 parent 7e9b4cc commit c1e148b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions libs/blocks/table/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down

0 comments on commit c1e148b

Please sign in to comment.