Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify pathname docs, follow spec with fragments #2448

merged 2 commits into from Jul 3, 2019


Copy link

commented Jul 3, 2019


This is multi-part:

  • A few parts of the docs were updated to clear up some confusion and bring some clarity.
  • Valid URLs must not contain a # within its fragment per spec (see #2445). This removes the hash parameter parsing, to bring it in line with spec. (I suspect almost nobody actually uses this.)
    • I also removed the extra parameter to m.parseQueryString, which existed almost solely to support this.
  • I added a bunch of new tests to ensure a few more various edge cases were properly covered, including the report in #2440.
  • Prefix handling was corrected, so now, arbitrary URL paths can be used, complete with both path names, query strings, and hash strings. For instance, ?# is now correctly handled as a prefix.

Motivation and Context

Fixes #2440 by just updating the docs
Fixes #2445
Also fixes a bug I found along the way. (That's where the prefix handling fix came in.)

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation change


  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated docs/
Clarify pathname docs, follow spec with fragments
- Valid URLs must not contain a `#` within its fragment.
- Our docs were a little confusing and misleading - `m.pathname` isn't
  aware of URLs, just path names.
- Removed the relevant extension to `m.parseQueryString` required to
  support the hash parsing extension. Now we just shave it off and
  ignore it.
- Fix support for arbitrary prefixes, so prefixes like `?#` are
  handled correctly.
- Add a bunch of tests to cover various areas of confusion and unusual
  edge cases.

@project-bot project-bot bot added this to Needs triage in Triage/bugs Jul 3, 2019

@isiahmeadows isiahmeadows merged commit 85bfd0f into MithrilJS:next Jul 3, 2019

Triage/bugs automation moved this from Needs triage to Closed Jul 3, 2019

@isiahmeadows isiahmeadows deleted the isiahmeadows:fix-pathname branch Jul 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant
You can’t perform that action at this time.