Get hostname in a cross-browser compatible way

Internet Explorer looses A.hostname property when href is set
dynamically with .setAttribute('href', '/whatever'). This is a problem
with client side templating engines like knockout.js. E.g. this link
created with templating would not work correctly in sammy.js, as it does
not have hostname.
<a data-bind="text: text, attr: { href: url}"></a>

The issues is fixed by checking hostname, and if it is missing, create a
new link and query the hostname from that link.
Fixed intendation, created test
fix hostname issue in IE; fixes #183