mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Update serialize-doctype.ts
This commit is contained in:
parent
50d61960c2
commit
a6fee57c11
@ -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 '<html></html>';
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user