Skip to content

File tree

src/client/domparser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ const HEAD = 'head';
66
const BODY = 'body';
77
const FIRST_TAG_REGEX = /<([a-zA-Z]+[0-9]?)/; // e.g., <h1>
88

9-
// match-all-characters in case of newlines (DOTALL)
10-
const HEAD_TAG_REGEX = /<head[^]*>/i;
11-
const BODY_TAG_REGEX = /<body[^]*>/i;
9+
// match opening <head> or <body> tags with optional attributes
10+
const HEAD_TAG_REGEX = /<head[^>]*>/i;
11+
const BODY_TAG_REGEX = /<body[^>]*>/i;
1212

1313
// falls back to `parseFromString` if `createHTMLDocument` cannot be used
1414
/* eslint-disable @typescript-eslint/no-unused-vars */

0 commit comments

Comments
 (0)