Skip to content

fix: align form number handling with HTML spec#16320

Draft
elliott-with-the-longest-name-on-github wants to merge 1 commit into
version-3from
elliott/dom-number-sync
Draft

fix: align form number handling with HTML spec#16320
elliott-with-the-longest-name-on-github wants to merge 1 commit into
version-3from
elliott/dom-number-sync

Conversation

@elliott-with-the-longest-name-on-github

Copy link
Copy Markdown
Contributor

Closes #16270

Basically, the problem is that we were handling numbers in a HTML-spec-incompliant way. I've adjusted the handling so that we:

  • Don't sync our internally-parsed version back to the HTML input -- it owns its own state
  • Treat HTML-invalid numbers as undefined

One alternative approach to this would be to save the last valid number we got and use that, but that seems... wrong.

@pkg-svelte-dev

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from a23295b:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/a23295b9becb0cbf0ec7668cb93880d7382e5042

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/16320

@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a23295b

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@svelte-docs-bot

Copy link
Copy Markdown

@Rich-Harris

Copy link
Copy Markdown
Member

Cursor is still jumping:

Screen.Recording.2026-07-10.at.3.47.24.PM.mov

* @returns {number | undefined}
*/
function parse_number_value(value) {
if (value === '' || !valid_floating_point_number_regex.test(value)) return undefined;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can an invalid value other than '' even happen? I can't find a way to enter one

@Rich-Harris

Copy link
Copy Markdown
Member

marking this as draft

@Rich-Harris
Rich-Harris marked this pull request as draft July 14, 2026 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants