https://github.com/angular/angular
Raw File
Tip revision: 6d14fc52b9103b4fdbee8e4564c05fa599a90a1d authored by Dylan Hunn on 28 March 2024, 17:02:39 UTC
release: cut the v18.0.0-next.2 release
Tip revision: 6d14fc5
security.ts
import { htmlSafeByReview } from 'safevalues/restricted/reviewed';

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

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

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