Skip to content

Commit

Permalink
normalize all returned nodes
Browse files Browse the repository at this point in the history
normalizing details is technically redundant but buildLists expects
a Node too so doing both to all nodes is cleaner

TODO: improve buildLists to action on every stray list item?
  • Loading branch information
AprilSylph committed Nov 22, 2021
1 parent 9195a56 commit 38d80b6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/lib/npf.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ export const renderContent = ({ content: blocks, layout }) => {
}
});

buildLists(content);
if (askContent instanceof DocumentFragment) buildLists(askContent);
if (details instanceof Element) buildLists(details);
[content, askContent, details]
.filter(variable => variable instanceof Node)
.forEach(node => {
node.normalize();
buildLists(node);
});

return {
content,
Expand Down

0 comments on commit 38d80b6

Please sign in to comment.