Skip to content

Remove SubmitEvent polyfill#37276

Merged
silverwind merged 1 commit intogo-gitea:mainfrom
silverwind:subpoly
Apr 18, 2026
Merged

Remove SubmitEvent polyfill#37276
silverwind merged 1 commit intogo-gitea:mainfrom
silverwind:subpoly

Conversation

@silverwind
Copy link
Copy Markdown
Member

@silverwind silverwind commented Apr 18, 2026

Remove this obsolete polyfill as per #37270 (comment).

PaleMoon/UXP now supports the native SubmitEvent API (per go-gitea#37270
comment thread), so the polyfill added for it is dead weight. Remove the
`submitEventSubmitter` wrapper, the `initSubmitEventPolyfill` init function,
its two document.body listeners, and the `form._submitter` expando. Call sites
use `e.submitter` directly. `repo-diff.ts` switches from `nodeName` string
comparisons to `instanceof HTMLButtonElement` / `HTMLInputElement` for cleaner
type narrowing.

Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 18, 2026
@silverwind silverwind requested a review from Copilot April 18, 2026 10:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the legacy SubmitEvent polyfill now that PaleMoon/UXP supports the native API, and updates submit-handling call sites to use SubmitEvent.submitter directly (with improved type narrowing in repo-diff.ts).

Changes:

  • Deleted SubmitEvent polyfill helpers (submitEventSubmitter, initSubmitEventPolyfill, and _submitter expando tracking).
  • Removed polyfill initialization from the global JS init pipeline.
  • Updated submit handlers to use e.submitter directly and replaced nodeName checks with instanceof-based narrowing.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
web_src/js/utils/dom.ts Removes the SubmitEvent polyfill implementation and related helpers.
web_src/js/index.ts Drops polyfill import and init call from the global initializer list.
web_src/js/features/repo-diff.ts Uses e.submitter directly and narrows submitter type via instanceof.
web_src/js/features/common-fetch-action.ts Uses e.submitter directly and adjusts option typing to allow null submitters.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 18, 2026
@silverwind
Copy link
Copy Markdown
Member Author

silverwind commented Apr 18, 2026

I also verified the e.originalEvent removal: none of the callers passed jQuery events to the previous function so the removal is safe.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 18, 2026
@lunny lunny added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Apr 18, 2026
@silverwind silverwind merged commit 0824610 into go-gitea:main Apr 18, 2026
30 checks passed
@silverwind silverwind deleted the subpoly branch April 18, 2026 18:55
@GiteaBot GiteaBot added this to the 1.27.0 milestone Apr 18, 2026
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 20, 2026
* main: (25 commits)
  Add WebKit to e2e test matrix (go-gitea#37298)
  Don't add useless labels which will bother changelog generation (go-gitea#37267)
  Fix Repository transferring page (go-gitea#37277)
  Stabilize issue-project e2e test, increase timeout factor (go-gitea#37297)
  Fix Mermaid diagrams failing when node labels contain line breaks (go-gitea#37296)
  Add project column picker to issue and pull request sidebar (go-gitea#37037)
  Fix container auth for public instance (go-gitea#37290)
  Refactor frontend `tw-justify-between` layouts to `flex-left-right` (go-gitea#37291)
  Update Nix flake (go-gitea#37284)
  Workflow Artifact Info Hover (go-gitea#37100)
  [skip ci] Updated translations via Crowdin
  release notes for 1.26.0 (go-gitea#37282)
  Enhance GetActionWorkflow to support fallback references (go-gitea#37189)
  Refactor LDAP tests (go-gitea#37274)
  Remove `SubmitEvent` polyfill (go-gitea#37276)
  Upgrade go-git to v5.18.0 (go-gitea#37268)
  Avoid top-level await (go-gitea#37272)
  Frontend iframe renderer framework: 3D models, OpenAPI (go-gitea#37233)
  pull: Fix CODEOWNERS absolute path matching. (go-gitea#37244)
  Swift registry metadata: preserve more JSON fields and accept empty metadata (go-gitea#37254)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/refactoring Existing code has been cleaned up. There should be no new functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants