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

Comments

Projects
None yet
2 participants
@carystanley
Copy link

carystanley commented Aug 14, 2013

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

This comment has been minimized.

Copy link

carystanley commented Aug 14, 2013

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

This comment has been minimized.

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

Enforce a router's `root` as its mount point
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

This comment has been minimized.

Copy link
Member

ericf commented Sep 19, 2013

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

@ericf ericf closed this Sep 19, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment