Hopefully fixed href bugs for all browsers now.

This commit is contained in:
Lars Jung 2012-07-16 17:23:01 +02:00
parent 8fea7bfb74
commit 68497e749b
2 changed files with 14 additions and 2 deletions

View file

@ -2,7 +2,19 @@
modulejs.define('model/entry', ['_', 'core/types', 'core/ajax'], function (_, types, ajax) {
var domain = document.domain,
location = document.location.href.replace(/^.*:\/\/[^\/]*/, '').replace(/[^\/]*$/, ''),
location = (function () {
var location = document.location.pathname.replace(/[^\/]*$/, ''),
testpathname = '/a b',
a = document.createElement('a');
a.href = testpathname;
if (a.pathname === testpathname) {
location = encodeURIComponent(location).replace(/%2F/ig, '/').replace(/'/g, '%27');
}
return location;
}()),
// utils