Comparing version 0.4.0 to 0.4.1
Changelog | ||
========= | ||
### 0.4.1 (October 21, 2016) | ||
* Fix IE parseUrl bug for relative paths | ||
### 0.4.0 (September 18, 2016) | ||
@@ -5,0 +9,0 @@ |
@@ -27,10 +27,9 @@ var HTTP_PORT = '80'; | ||
// resolve the `href` property but will keep the `..` in the `path` property. | ||
// To workaround this, we reparse with the full URL from the `href` property. | ||
if (url.charAt(0) == '.') return parseUrl(a.href); | ||
// It will also not include the `host` or `hostname` properties. Furthermore, | ||
// IE will sometimes return no protocol or just a colon, especially for things | ||
// like relative protocol URLs (e.g. "//google.com"). | ||
// To workaround all of these issues, we reparse with the full URL from the | ||
// `href` property. | ||
if (url.charAt(0) == '.' || url.charAt(0) == '/') return parseUrl(a.href); | ||
// Sometimes IE will return no port or just a colon, especially for things | ||
// like relative port URLs (e.g. "//google.com"). | ||
var protocol = !a.protocol || ':' == a.protocol ? | ||
location.protocol : a.protocol; | ||
// Don't include default ports. | ||
@@ -42,13 +41,9 @@ var port = (a.port == HTTP_PORT || a.port == HTTPS_PORT) ? '' : a.port; | ||
// IE will return an empty string for host and hostname with a relative URL. | ||
var host = a.host == '' ? location.host : a.host; | ||
var hostname = a.hostname == '' ? location.hostname : a.hostname; | ||
// Sometimes IE incorrectly includes a port for default ports | ||
// (e.g. `:80` or `:443`) even when no port is specified in the URL. | ||
// http://bit.ly/1rQNoMg | ||
host = host.replace(DEFAULT_PORT, ''); | ||
var host = a.host.replace(DEFAULT_PORT, ''); | ||
// Not all browser support `origin` so we have to build it. | ||
var origin = a.origin ? a.origin : protocol + '//' + host; | ||
var origin = a.origin ? a.origin : a.protocol + '//' + host; | ||
@@ -62,9 +57,8 @@ // Sometimes IE doesn't include the leading slash for pathname. | ||
host: host, | ||
hostname: hostname, | ||
hostname: a.hostname, | ||
href: a.href, | ||
origin: origin, | ||
pathname: pathname, | ||
port: port, | ||
protocol: protocol, | ||
protocol: a.protocol, | ||
search: a.search, | ||
@@ -71,0 +65,0 @@ |
{ | ||
"name": "dom-utils", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "A small, modular DOM utilities library", | ||
@@ -25,3 +25,3 @@ "scripts": { | ||
"browserify": "^13.0.0", | ||
"easy-sauce": "^0.3.5", | ||
"easy-sauce": "^0.4.0", | ||
"eslint": "^3.0.1", | ||
@@ -35,2 +35,17 @@ "mocha": "^2.4.5", | ||
[ | ||
"Windows 10", | ||
"chrome", | ||
"latest" | ||
], | ||
[ | ||
"Linux", | ||
"firefox", | ||
"latest" | ||
], | ||
[ | ||
"OS X 10.11", | ||
"safari", | ||
"9" | ||
], | ||
[ | ||
"OS X 10.8", | ||
@@ -61,2 +76,7 @@ "safari", | ||
[ | ||
"Windows XP", | ||
"internet explorer", | ||
"8" | ||
], | ||
[ | ||
"OS X 10.10", | ||
@@ -63,0 +83,0 @@ "iPhone", |
32233
689