window.mjs 451 B

12345678910111213141516
  1. /**
  2. * @license
  3. * SPDX-License-Identifier: Apache-2.0
  4. */
  5. import { unwrapUrlOrSanitize } from '../../builders/url_sanitizer';
  6. /**
  7. * open calls {@link Window.open} on the given {@link Window}, given a
  8. * target {@link Url}.
  9. */
  10. export function open(win, url, target, features) {
  11. const sanitizedUrl = unwrapUrlOrSanitize(url);
  12. if (sanitizedUrl !== undefined) {
  13. return win.open(sanitizedUrl, target, features);
  14. }
  15. return null;
  16. }