iframe.mjs 541 B

1234567891011121314151617
  1. /**
  2. * @license
  3. * SPDX-License-Identifier: Apache-2.0
  4. */
  5. /**
  6. * @fileoverview Safe iframe helpers and go/intents-for-iframes-for-closure
  7. */
  8. import { unwrapHtml } from '../../internals/html_impl';
  9. import { unwrapResourceUrl } from '../../internals/resource_url_impl';
  10. /** Sets the Src attribute using a TrustedResourceUrl */
  11. export function setSrc(iframe, v) {
  12. iframe.src = unwrapResourceUrl(v).toString();
  13. }
  14. /** Sets the Srcdoc attribute using a SafeHtml */
  15. export function setSrcdoc(iframe, v) {
  16. iframe.srcdoc = unwrapHtml(v);
  17. }