iframe.js 748 B

12345678910111213141516171819202122
  1. "use strict";
  2. /**
  3. * @license
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. Object.defineProperty(exports, "__esModule", { value: true });
  7. exports.setSrcdoc = exports.setSrc = void 0;
  8. /**
  9. * @fileoverview Safe iframe helpers and go/intents-for-iframes-for-closure
  10. */
  11. var html_impl_1 = require("../../internals/html_impl");
  12. var resource_url_impl_1 = require("../../internals/resource_url_impl");
  13. /** Sets the Src attribute using a TrustedResourceUrl */
  14. function setSrc(iframe, v) {
  15. iframe.src = (0, resource_url_impl_1.unwrapResourceUrl)(v).toString();
  16. }
  17. exports.setSrc = setSrc;
  18. /** Sets the Srcdoc attribute using a SafeHtml */
  19. function setSrcdoc(iframe, v) {
  20. iframe.srcdoc = (0, html_impl_1.unwrapHtml)(v);
  21. }
  22. exports.setSrcdoc = setSrcdoc;