Skip to content

Commit 4a012c2

Browse files
authored
Update src/build/mdn-comments.ts
1 parent 9421fae commit 4a012c2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/build/mdn-comments.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ function insertComment(
6161
}
6262

6363
function generateComment(summary: string, name: string): string | undefined {
64-
// Escape special regex characters in the name
65-
if (["."].some((c) => name.includes(c))) {
64+
// Ban any non-alphanumeric characters in the name for safe regex
65+
// For now the only known exception is `RTCStatsReport/Symbol.iterator`.
66+
if (name.match(/\W/)) {
6667
return;
6768
}
6869

0 commit comments

Comments
 (0)