This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Description
The following script:
var url = require('url');
console.log(url.resolve('http://www.example.com/path/to/edit', 'view'));
console.log(url.resolve('/path/to/edit', 'view'));
console.log(url.resolve('http://www.example.com/path/to/edit', '.'));
console.log(url.resolve('/path/to/edit', '.'));
produces the following output:
http://www.example.com/path/to/view
/path/to/view
http://www.example.com/path/to/
/path/to
which is: resolving '.' produces a result that contains a trailing slash if the base url is absolute including host, but leaves it off if there is no host name (AKA "relative to the domain root").
These are very different urls both for a webserver and as a base url for a browser.
On every browser I have tested, using the following html
<html>
<head>
<base href="/path/to/edit" />
</head>
<body>
<a href="." onclick="alert(this.href); return false">test</a>
</body>
</html>
the href of the test link also always includes the slash.
Tested with v0.10.35