Skip to content

Commit

Permalink
fix: firstChild undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
buuhuu committed Feb 21, 2024
1 parent 0d6e559 commit 024f15c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/aem.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ function decorateBlock(block) {
const cellText = cell.textContent.trim();
if ((!firstChild && cellText)
|| (firstChild && !firstChild.tagName.match(/^(P(RE)?|H[1-6]|(U|O)L|TABLE)$/))) {
const tag = firstChild.tagName === 'CODE' && cellText === firstChild.textContent.trim() ? 'pre' : 'p';
const tag = firstChild && firstChild.tagName === 'CODE' && cellText === firstChild.textContent.trim() ? 'pre' : 'p';
const paragraph = document.createElement(tag);
paragraph.append(...cell.childNodes);
cell.replaceChildren(paragraph);
Expand Down

0 comments on commit 024f15c

Please sign in to comment.