From a6fee57c11fc238228abe9322e854d9c3a4d7ddb Mon Sep 17 00:00:00 2001 From: Jun Date: Fri, 25 Feb 2022 14:59:30 -0800 Subject: [PATCH] Update serialize-doctype.ts --- src/dom/serialize-doctype.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/dom/serialize-doctype.ts b/src/dom/serialize-doctype.ts index 84c17a8..91dde8e 100644 --- a/src/dom/serialize-doctype.ts +++ b/src/dom/serialize-doctype.ts @@ -23,8 +23,7 @@ const htmlEscape = (str: string | null): string => { return escaped; } -// @ts-ignore -const createDocType = (ignored: string, doctype?: DocumentType | null): string => { +const createDocType = (doctype?: DocumentType | null): string => { if (!doctype) return ''; @@ -39,7 +38,9 @@ const createDocType = (ignored: string, doctype?: DocumentType | null): string = let doctypePolicy: TrustedTypePolicy; if ((window as any).trustedTypes) { doctypePolicy = (window as any).trustedTypes.createPolicy('html2canvas', { - createHTML: createDocType + createHTML: (ignored: string, doctype?: DocumentType | null): TrustedHTML => { + return createDocType(doctype); + } }); } @@ -47,6 +48,6 @@ export const serializeDoctype = (doctype?: DocumentType | null): string | Truste if (doctypePolicy !== undefined) { return doctypePolicy.createHTML('', doctype); } else { - return createDocType('', doctype); + return createDocType(doctype); } }