Updates location checking.

This commit is contained in:
Lars Jung 2012-07-17 13:49:37 +02:00
parent f65f5021ae
commit 30d48fb1ef

View file

@ -1,11 +1,12 @@
modulejs.define('model/entry', ['_', 'core/types', 'core/ajax'], function (_, types, ajax) {
var domain = document.domain,
var doc = document,
domain = doc.domain,
location = (function () {
var testpathname = '/a b',
a = document.createElement('a'),
a = doc.createElement('a'),
isDecoded, location;
a.href = testpathname;
@ -18,6 +19,10 @@ modulejs.define('model/entry', ['_', 'core/types', 'core/ajax'], function (_, ty
location = encodeURIComponent(location).replace(/%2F/ig, '/').replace(/'/g, '%27');
}
if (!location) {
location = doc.location.href.replace(/.*:\/\/[^\/]*/, '').replace(/[^\/]*$/, '');
}
return location;
}()),