button.mjs 372 B

1234567891011121314
  1. /**
  2. * @license
  3. * SPDX-License-Identifier: Apache-2.0
  4. */
  5. import { unwrapUrlOrSanitize } from '../../builders/url_sanitizer';
  6. /**
  7. * Sets the Formaction attribute from the given Url.
  8. */
  9. export function setFormaction(button, url) {
  10. const sanitizedUrl = unwrapUrlOrSanitize(url);
  11. if (sanitizedUrl !== undefined) {
  12. button.formAction = sanitizedUrl;
  13. }
  14. }