local-links
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -28,2 +28,5 @@ function isHTMLElement(obj) { | ||
// [2] https://github.com/substack/catch-links/blob/7aee219cdc2c845c78caad6070886a9380b90e4c/index.js#L13-L17 | ||
// [3] IE10 (and possibly later) report that anchor.port is the default port | ||
// but dont append it to the hostname, so if the host doesnt end with the port | ||
// append it to the anchor host as well | ||
@@ -47,3 +50,5 @@ function isLocal(event, anchor, lookForHash) { | ||
var aHost = anchor.host; | ||
var aPort = anchor.port; | ||
var wHost = window.location.host; | ||
var wPort = window.location.port; | ||
@@ -56,7 +61,8 @@ // Some browsers (Chrome 36) return an empty string for anchor.hash | ||
// Window has no port, but anchor has the default port | ||
if (!window.location.port && anchor.port && (anchor.port === '80' || anchor.port === '443')) { | ||
if (!wPort && aPort && (aPort === '80' || aPort === '443')) { | ||
// IE9 sometimes includes the default port (80 or 443) on anchor.host | ||
// so we append the default port to the window host in this case | ||
// so they will match for the host equality check [1] | ||
wHost += ':' + anchor.port; | ||
wHost += ':' + aPort; | ||
aHost += aHost.indexOf(aPort, aHost.length - aPort.length) === -1 ? ':' + aPort : ''; // [3] | ||
} | ||
@@ -63,0 +69,0 @@ |
{ | ||
"name": "local-links", | ||
"description": "Determine cross-browser if an event or anchor element should be handled locally.", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"author": "Luke Karrys <luke@lukekarrys.com>", | ||
@@ -34,2 +34,3 @@ "bugs": { | ||
"start": "run-browser test/index.js", | ||
"start-80": "run-browser test/index.js --port 80", | ||
"test": "browserify test/index.js | tape-run -b phantom | tap-spec" | ||
@@ -36,0 +37,0 @@ }, |
@@ -111,2 +111,5 @@ local-links | ||
It is also a good idea to run `sudo npm run start-80` (requires admin) which will run the tests on [`http://localhost`](http://localhost) | ||
because there can be unexpected behavior when the host has no port in [IE9](https://github.com/lukekarrys/local-links/blob/master/local-links.js#L26) and [IE10](https://github.com/lukekarrys/local-links/blob/master/local-links.js#L28). | ||
To run the tests in the cli, just run `npm test`. | ||
@@ -113,0 +116,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18830
312
120