https://github.com/angular/angular
Raw File
Tip revision: 6459b253e827a145e51a74289cc563d488956ba0 authored by Jessica Janiuk on 02 March 2022, 18:51:46 UTC
release: cut the v14.0.0-next.5 release (#45243)
Tip revision: 6459b25
security.ts
import { htmlFromStringKnownToSatisfyTypeContract } from 'safevalues/unsafe/reviewed';

export function fromInnerHTML(el: Element): TrustedHTML {
  // SECURITY: Existing innerHTML content is already trusted.
  return htmlFromStringKnownToSatisfyTypeContract(el.innerHTML, '^');
}

export function fromOuterHTML(el: Element): TrustedHTML {
  // SECURITY: Existing outerHTML content is already trusted.
  return htmlFromStringKnownToSatisfyTypeContract(el.outerHTML, '^');
}

export function svg(constantSvg: TemplateStringsArray): TrustedHTML {
  // SECURITY: Template literal argument with no interpolation is constant, and
  // hence trusted.
  return htmlFromStringKnownToSatisfyTypeContract(constantSvg[0], '^');
}
back to top