Skip to content

Commit cdd8c87

Browse files
committed
Use instanceof instead of string comparison
1 parent 21dd571 commit cdd8c87

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Utility.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export function replaceTextNode (element: HTMLElement | Element, value: string):
9090
*/
9191
export function sanitizeElement (element: HTMLElement): HTMLElement {
9292
const sanitizedElement = DOMPurify.sanitize(element, { RETURN_DOM: true });
93-
if (sanitizedElement.tagName.toLowerCase() === 'body' && element.tagName.toLowerCase() !== 'body') {
93+
if (sanitizedElement instanceof HTMLBodyElement && !(element instanceof HTMLBodyElement)) {
9494
return sanitizedElement.firstElementChild as HTMLElement;
9595
}
9696
return sanitizedElement;

0 commit comments

Comments
 (0)