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

"Root" not enforced in Y.Router #1083

Closed
carystanley opened this issue Aug 14, 2013 · 3 comments
Closed

"Root" not enforced in Y.Router #1083

carystanley opened this issue Aug 14, 2013 · 3 comments
Assignees
Labels

Comments

@carystanley
Copy link

If I use Y.Route with a base, then I expect the router only to work for urls that are in that base. If I have a root "/myapp/" then when a user clicks on a link "/", I want that to leave the app and navigate to the base of the website, not the base of my applet.

removeRoot only strips the the root if it exists, I think it should enforce the root, so that I can have both links that navigate within the app, as well as links that can naviagte outside the app

@carystanley
Copy link
Author

This enforcement behavior should probably be configurable, since some users may what to use a sort of relative linking

@ghost ghost assigned ericf Aug 16, 2013
@ericf
Copy link
Member

ericf commented Aug 16, 2013

@carystanley makes sense, I'll look into how we can make root also act as a mount-point.

ericf added a commit to ericf/yui3 that referenced this issue Sep 16, 2013
This enforces routers with a specified `root` to only consider paths as
matching its route handles if that path is semantically within the
router's `root` path. For example:

    router.set('root', '/app/');

    router.hasRoute('/app/');    // => true
    router.hasRoute('/app/foo'); // => true
    router.hasRoute('/bar/');    // => false

This change fixes some issues with paths being erroneously considered
matching even when they were not semantically within the router's `root`
path.

The `getPath()` method now returns the _full_ current path, whereas
before it returned the current path relative to the router's `root`.

These changes will break backwards compatibility with some apps, but
fix some fundamental issues with how Y.Router handled `root` paths.

Fixes yui#1083
@ericf
Copy link
Member

ericf commented Sep 19, 2013

Merged #1198 into dev-3.x, closing.

@ericf ericf closed this as completed Sep 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants