Fix IE bug with relative URLs

This commit is contained in:
Kegan Myers 2014-04-17 23:32:24 -05:00
parent 8f33fa7689
commit d9556de24e
7 changed files with 13 additions and 5 deletions

View file

@ -1,6 +1,6 @@
{
"name": "Typertext",
"version": "0.6.2",
"version": "0.6.3",
"homepage": "https://github.com/terribleplan/Typertext",
"authors": [
"Kegan Myers <kegan@keganmyers.com>"

View file

@ -191,6 +191,9 @@ var Typertext;
HttpUrl.FromUrl = function (location) {
var l = document.createElement("a");
l.href = location;
if (!l.hostname || !l.protocol || !l.pathname || !l.search || !l.port) {
l.href = l.href;
}
return new HttpUrl(l.hostname, Typertext.Http.HttpProtocol[l.protocol.slice(0, -1)], l.pathname, HttpUrl.DecodeQueryString(l.search), parseInt(l.port));
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -35,6 +35,11 @@ module Typertext.Http {
public static FromUrl(location:string):HttpUrl {
var l = document.createElement("a");
l.href = location;
if (!l.hostname || !l.protocol || !l.pathname || !l.search || !l.port) {
//This may seem silly, but it is serious business for IE and relative URLs
//noinspection SillyAssignmentJS
l.href = l.href;
}
return new HttpUrl(l.hostname, HttpProtocol[l.protocol.slice(0,-1)], l.pathname, HttpUrl.DecodeQueryString(l.search), parseInt(l.port))
}

View file

@ -5,7 +5,7 @@
"type": "git",
"url": "https://github.com/terribleplan/Typertext.git"
},
"version": "0.6.2",
"version": "0.6.3",
"devDependencies": {
"grunt": "~0.4.2",
"grunt-cli": "~0.1.13",