fix for urls with same host in createUrlObject in IE. r=tschaub (pullup
#2060) git-svn-id: http://svn.openlayers.org/trunk/openlayers@9320 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -1356,7 +1356,10 @@ OpenLayers.Util.createUrlObject = function(url, options) {
|
|||||||
a.href = url;
|
a.href = url;
|
||||||
|
|
||||||
//host (without port)
|
//host (without port)
|
||||||
urlObject.host = a.host;
|
// if we don't have a host (which is the case with URLs starting with "/"
|
||||||
|
// in IE), take the window location's host to match other browsers that
|
||||||
|
// fill in the window's location host automatically
|
||||||
|
urlObject.host = a.host || window.location.host;
|
||||||
var port = a.port;
|
var port = a.port;
|
||||||
if (port.length <= 0) {
|
if (port.length <= 0) {
|
||||||
var newHostLength = urlObject.host.length - (port.length);
|
var newHostLength = urlObject.host.length - (port.length);
|
||||||
@@ -1380,7 +1383,6 @@ OpenLayers.Util.createUrlObject = function(url, options) {
|
|||||||
}
|
}
|
||||||
urlObject.args = OpenLayers.Util.getParameters(queryString);
|
urlObject.args = OpenLayers.Util.getParameters(queryString);
|
||||||
|
|
||||||
|
|
||||||
//pathname (this part allows for relative <-> absolute comparison)
|
//pathname (this part allows for relative <-> absolute comparison)
|
||||||
if ( ((urlObject.protocol == "file:") && (url.indexOf("file:") != -1)) ||
|
if ( ((urlObject.protocol == "file:") && (url.indexOf("file:") != -1)) ||
|
||||||
((urlObject.protocol != "file:") && (urlObject.host != "")) ) {
|
((urlObject.protocol != "file:") && (urlObject.host != "")) ) {
|
||||||
|
|||||||
@@ -606,7 +606,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_Util_isEquivalentUrl(t) {
|
function test_Util_isEquivalentUrl(t) {
|
||||||
t.plan(8);
|
t.plan(9);
|
||||||
|
|
||||||
var url1, url2, options;
|
var url1, url2, options;
|
||||||
|
|
||||||
@@ -664,6 +664,11 @@
|
|||||||
url2 = "../tests/../tests/foo.html?bar=now#go";
|
url2 = "../tests/../tests/foo.html?bar=now#go";
|
||||||
|
|
||||||
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "relative vs. absolute paths works");
|
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "relative vs. absolute paths works");
|
||||||
|
|
||||||
|
url1 = "/foo/bar";
|
||||||
|
url2 = new Array(window.location.pathname.split("/").length-1).join("../")+"foo/bar";
|
||||||
|
|
||||||
|
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "absolute and relative path without host works for "+url2)
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_Util_createUniqueIDSeq(t) {
|
function test_Util_createUniqueIDSeq(t) {
|
||||||
|
|||||||
Reference in New Issue
Block a user