https://github.com/angular/angular
Raw File
Tip revision: b868f1c94ea779691ae5c1232141de79b806045f authored by Andrew Kushnir on 03 August 2022, 17:41:36 UTC
release: cut the v14.1.1 release
Tip revision: b868f1c
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