export class SyntheticSubmitEvent extends Event {
  #form: HTMLFormElement

  #submitter?: HTMLElement | null

  constructor(type: string, form: HTMLFormElement, eventInitDict?: SubmitEventInit) {
    super(type, eventInitDict)
    this.#form = form
    this.#submitter = eventInitDict?.submitter
  }

  get form(): HTMLFormElement {
    return this.#form
  }

  get submitter(): HTMLElement | null | undefined {
    return this.#submitter
  }

  override get target(): HTMLFormElement {
    return this.#form
  }

  override get currentTarget(): HTMLFormElement {
    return this.#form
  }
}
