( unsafeHtml: any, tagName?: string, propName?: string, )
| 49 | * @codeGenApi |
| 50 | */ |
| 51 | export function ɵɵsanitizeHtml( |
| 52 | unsafeHtml: any, |
| 53 | tagName?: string, |
| 54 | propName?: string, |
| 55 | ): TrustedHTML | string { |
| 56 | if ( |
| 57 | tagName !== undefined && |
| 58 | propName !== undefined && |
| 59 | getSecurityContext(tagName, propName) !== SecurityContext.HTML |
| 60 | ) { |
| 61 | return unsafeHtml; |
| 62 | } |
| 63 | |
| 64 | const sanitizer = getSanitizer(); |
| 65 | if (sanitizer) { |
| 66 | return trustedHTMLFromStringBypass(sanitizer.sanitize(SecurityContext.HTML, unsafeHtml) || ''); |
| 67 | } |
| 68 | if (allowSanitizationBypassAndThrow(unsafeHtml, BypassType.Html)) { |
| 69 | return trustedHTMLFromStringBypass(unwrapSafeValue(unsafeHtml)); |
| 70 | } |
| 71 | return _sanitizeHtml(getDocument(), renderStringify(unsafeHtml)); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * A `style` sanitizer which converts untrusted `style` **string** into trusted string by removing |
no test coverage detected