Fix IE bug with relative URLs
This commit is contained in:
parent
8f33fa7689
commit
d9556de24e
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Typertext",
|
"name": "Typertext",
|
||||||
"version": "0.6.2",
|
"version": "0.6.3",
|
||||||
"homepage": "https://github.com/terribleplan/Typertext",
|
"homepage": "https://github.com/terribleplan/Typertext",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Kegan Myers <kegan@keganmyers.com>"
|
"Kegan Myers <kegan@keganmyers.com>"
|
||||||
|
|
|
@ -191,6 +191,9 @@ var Typertext;
|
||||||
HttpUrl.FromUrl = function (location) {
|
HttpUrl.FromUrl = function (location) {
|
||||||
var l = document.createElement("a");
|
var l = document.createElement("a");
|
||||||
l.href = location;
|
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));
|
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
2
build/typertext.min.js
vendored
2
build/typertext.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -35,6 +35,11 @@ module Typertext.Http {
|
||||||
public static FromUrl(location:string):HttpUrl {
|
public static FromUrl(location:string):HttpUrl {
|
||||||
var l = document.createElement("a");
|
var l = document.createElement("a");
|
||||||
l.href = location;
|
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))
|
return new HttpUrl(l.hostname, HttpProtocol[l.protocol.slice(0,-1)], l.pathname, HttpUrl.DecodeQueryString(l.search), parseInt(l.port))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/terribleplan/Typertext.git"
|
"url": "https://github.com/terribleplan/Typertext.git"
|
||||||
},
|
},
|
||||||
"version": "0.6.2",
|
"version": "0.6.3",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt": "~0.4.2",
|
"grunt": "~0.4.2",
|
||||||
"grunt-cli": "~0.1.13",
|
"grunt-cli": "~0.1.13",
|
||||||
|
|
Reference in a new issue