Skip to content

Default URLWhitespaceMode to .allow#370

Merged
aehlke merged 1 commit intoscinfu:masterfrom
macdrevx:allow-whitespace-by-default
Feb 11, 2026
Merged

Default URLWhitespaceMode to .allow#370
aehlke merged 1 commit intoscinfu:masterfrom
macdrevx:allow-whitespace-by-default

Conversation

@macdrevx
Copy link
Contributor

Summary

  • Changes the default URLWhitespaceMode from .strict to .allow
  • URLs with leading/trailing whitespace now pass protocol validation (using trimmed values) while preserving the original whitespace in output
  • This aligns with the HTML5 spec where URLs may be "potentially surrounded by spaces," and with browser behavior (Chrome preserves whitespace in the DOM but trims when navigating)

Follow-up to #369, as discussed in that PR's comments.

Test plan

  • All 589 existing tests pass with the new default
  • Existing tests cover all three modes (.strict, .trim, .allow) via explicit configuration, so they are unaffected by the default change

🤖 Generated with Claude Code

Per the HTML5 spec, URLs may be "potentially surrounded by spaces."
Browsers like Chrome preserve whitespace in the DOM but trim when
navigating. Defaulting to .allow matches this behavior: protocol
validation uses trimmed values while output preserves the original,
avoiding silent attribute removal or value mutation.

Ref: scinfu#369

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@aehlke aehlke merged commit 6baf7e8 into scinfu:master Feb 11, 2026
3 checks passed
@aehlke
Copy link
Collaborator

aehlke commented Feb 11, 2026

Thanks so much. Nice work

@macdrevx macdrevx deleted the allow-whitespace-by-default branch February 11, 2026 02:06
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