We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
instanceof
1 parent 21dd571 commit cdd8c87Copy full SHA for cdd8c87
src/Utility.ts
@@ -90,7 +90,7 @@ export function replaceTextNode (element: HTMLElement | Element, value: string):
90
*/
91
export function sanitizeElement (element: HTMLElement): HTMLElement {
92
const sanitizedElement = DOMPurify.sanitize(element, { RETURN_DOM: true });
93
- if (sanitizedElement.tagName.toLowerCase() === 'body' && element.tagName.toLowerCase() !== 'body') {
+ if (sanitizedElement instanceof HTMLBodyElement && !(element instanceof HTMLBodyElement)) {
94
return sanitizedElement.firstElementChild as HTMLElement;
95
}
96
return sanitizedElement;
0 commit comments