-
Notifications
You must be signed in to change notification settings - Fork 476
fragmentURI methods for working with single page apps #2
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
Conversation
I already have more requests lined up for fragment-abuse. Thank you for your input! I currently have requests for three "competing" fragment-abuse "standards":
Google's abuse starts with #!, Fragment-Parameters start with #?, Backbone Routing has no simple identification I can see at the moment. Are there any other "standards" URI.js should handle in one way or another? |
I've only used Backbone for this situation -- Backbone is nice because it doesn't force you into any convention other than having a leading I didn't cover having only fragment-parameters in my tests. I'm not sure whether that would work correctly without some changes. But I doubt that the presence of a |
I'm still uncertain how to handle this. Looking at your patch, It's nothing that can be done from the outside (for the time being). I'd like to think about fragment-abusal some more… (if anyone has any opinions on the matter, please chime in!) |
Mmm, probably a In "search" or hash zone will apply... |
I was actually thinking about fragment-abuse not being a standardized thing. Anyone could do anything with the fragment. Storing data, other URLs, counting kittens… |
Oh, thanks :) |
|
I've come to the conclusion, that fragment abuse is done in too many different ways. I don't see a singular API for the matter. I'm not going to push any fragment abuse into the "core" (unless it was "standardized" somewhere). That said, I've added src/URI.fragmentURI.js and src/URI.fragmentQuery.js to demonstrate the process of enabling URI.js to do what you expect it to. I'll have to write some more doc on the matter, though. This way anyone can do their own custom hash thingy… agree? |
@rodneyrehm Offering an example of "here's one way you could handle fragment URIs" seems like a very reasonable compromise IMO. It directly addresses the two-part problem of "there's no standard way to handle fragment URIs" and "there wasn't an obvious place to extend URI.js to handle your own fragment URIs." It gets my vote of approval! |
awesome… If you have some words to share for the docs please do so. :) |
This library looks really good except for the fact that it didn't offer much utility in working with single page applications (e.g. using Backbone Router or Sammy.js). You can work around this by extracting the
fragment
from the URI, making a new URI from that, modifying it, and plugging it back into thefragment
of the original URI; or you could use the helper methods I added in this pull request.Tests are included, but documentation isn't. If the code meets your standards, I will be happy to update the pull request with changes to the documentation files as well.