Skip to content

Commit 1cacf33

Browse files
Merge pull request #15113 from guardian/comment-node
Fix logging for comment nodes
2 parents ed69450 + 6bd83b3 commit 1cacf33

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

dotcom-rendering/src/components/BlockquoteBlockComponent.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ const textElement =
122122
key,
123123
children,
124124
});
125+
case '#comment':
126+
return null;
125127
default:
126128
logger.warn(
127129
'BlockquoteBlockComponent: Unknown element received',

dotcom-rendering/src/components/SubheadingBlockComponent.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export const buildElementTree =
5454
} else if (node.nodeType === node.TEXT_NODE) {
5555
// plain text receives no styling
5656
return node.textContent;
57+
} else if (node.nodeName === '#comment') {
58+
return null;
5759
} else {
5860
logger.warn('SubheadingBlockComponent: Unknown element received', {
5961
isDev: process.env.NODE_ENV !== 'production',

0 commit comments

Comments
 (0)