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
merged 2 commits into from
Jul 3, 2019

Conversation

dead-claudia
Copy link
Member

Description

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 Our # behavior in routing is invalid per spec #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 m.parsePathname: extra slash is returned #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

Checklist:

  • 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/change-log.md

- Valid URLs must not contain a `#` within its fragment.
  MithrilJS#2445
- 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.
@dead-claudia dead-claudia merged commit 85bfd0f into MithrilJS:next Jul 3, 2019
@dead-claudia dead-claudia deleted the fix-pathname branch July 3, 2019 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

Our # behavior in routing is invalid per spec m.parsePathname: extra slash is returned
1 participant