https://github.com/angular/angular
Raw File
Tip revision: 9b8f056604891537e37d6e0231b28b99868bd041 authored by Andrew Kushnir on 15 September 2021, 17:26:25 UTC
release: cut the v12.2.6 release (#43462)
Tip revision: 9b8f056
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