|
|
@ -451,9 +451,11 @@ Url.prototype.resolveObject = function(relative) { |
|
|
|
} |
|
|
|
|
|
|
|
var result = new Url(); |
|
|
|
Object.keys(this).forEach(function(k) { |
|
|
|
result[k] = this[k]; |
|
|
|
}, this); |
|
|
|
var tkeys = Object.keys(this); |
|
|
|
for (var tk = 0; tk < tkeys.length; tk++) { |
|
|
|
var tkey = tkeys[tk]; |
|
|
|
result[tkey] = this[tkey]; |
|
|
|
} |
|
|
|
|
|
|
|
// hash is always overridden, no matter what.
|
|
|
|
// even href="" will remove it.
|
|
|
@ -468,10 +470,12 @@ Url.prototype.resolveObject = function(relative) { |
|
|
|
// hrefs like //foo/bar always cut to the protocol.
|
|
|
|
if (relative.slashes && !relative.protocol) { |
|
|
|
// take everything except the protocol from relative
|
|
|
|
Object.keys(relative).forEach(function(k) { |
|
|
|
if (k !== 'protocol') |
|
|
|
result[k] = relative[k]; |
|
|
|
}); |
|
|
|
var rkeys = Object.keys(relative); |
|
|
|
for (var rk = 0; rk < rkeys.length; rk++) { |
|
|
|
var rkey = rkeys[rk]; |
|
|
|
if (rkey !== 'protocol') |
|
|
|
result[rkey] = relative[rkey]; |
|
|
|
} |
|
|
|
|
|
|
|
//urlParse appends trailing / to urls like http://www.example.com
|
|
|
|
if (slashedProtocol[result.protocol] && |
|
|
@ -493,9 +497,11 @@ Url.prototype.resolveObject = function(relative) { |
|
|
|
// because that's known to be hostless.
|
|
|
|
// anything else is assumed to be absolute.
|
|
|
|
if (!slashedProtocol[relative.protocol]) { |
|
|
|
Object.keys(relative).forEach(function(k) { |
|
|
|
var keys = Object.keys(relative); |
|
|
|
for (var v = 0; v < keys.length; v++) { |
|
|
|
var k = keys[v]; |
|
|
|
result[k] = relative[k]; |
|
|
|
}); |
|
|
|
} |
|
|
|
result.href = result.format(); |
|
|
|
return result; |
|
|
|
} |
|
|
|