quirkey / sammy

Sammy is a tiny javascript framework built on top of jQuery, It's RESTful Evented Javascript.
http://sammyjs.org
MIT License
2.99k stars 384 forks source link

Relative route links in IE10 creates incorrect url #227

Open toha73 opened 9 years ago

toha73 commented 9 years ago

When you have anchor elements where the href is relative, ie. '#/form1', and follow the link to the route the address in the address is incorrect in IE10. This is because pathname for anchor element is an empty string in IE10 if the link is relative with hash.

Try this is IE10 and other browsers to see the difference:

var anchor = document.createElement('a');
anchor.href = '#/design';
alert("'" + anchor.pathname + "'");

I added a small fix in Sammy.DefaultLocationProxy.fullPath that seems to work:

return [location_obj.pathname || window.location.pathname, location_obj.search, hash].join('');