jupiterjs / jquerymx

jQuery MVC Extensions. jQuery extensions that makes all the annoying stuff easier.
http://javascriptmvc.com
553 stars 374 forks source link

dom/route minor changes & clean-up #71

Closed marnusw closed 13 years ago

marnusw commented 13 years ago

Changed a remaining case of window.location.hash to location.hash according to earlier clean-up.

.set() returns $.route for a fluent interface.

Caught myself passing a hash string to .set() with the '#!' included even though it gets added by the method. Figured this might easily happen so I added a check for it; now works for '!', '#!' or without prefix.

justinbmeyer commented 13 years ago

What is set for? I didn't notice that it was added. Why is this needed? Thanks.

marnusw commented 13 years ago

It is possible to set the url with an object using attrs() or by assigning a string to window.location.hash, but I wanted to be able to use either without worry and therefore I introduced set(). It takes an object or string as parameter and changes the url appropriately.

I use it for specific redirects such as going to the home page for which I specify the url string; this means I don't have to worry about what the route variables are. It also means you never have to use window.location.hash directly. Other than that I suppose the method is not that big a gain.