local-links
Advanced tools
Comparing version 1.0.10 to 1.1.0
@@ -45,2 +45,7 @@ function isHTMLElement(obj) { | ||
// Dont test anchors with target=_blank | ||
if (anchor.target === '_blank') { | ||
return null; | ||
} | ||
// IE9 doesn't put a leading slash on anchor.pathname [1] | ||
@@ -47,0 +52,0 @@ var aPathname = normalizeLeadingSlash(anchor.pathname); |
{ | ||
"name": "local-links", | ||
"description": "Determine cross-browser if an event or anchor element should be handled locally.", | ||
"version": "1.0.10", | ||
"version": "1.1.0", | ||
"author": "Luke Karrys <luke@lukekarrys.com>", | ||
@@ -6,0 +6,0 @@ "bugs": { |
@@ -101,2 +101,8 @@ local-links | ||
#### `target="_blank"` | ||
If the anchor has target="_blank" it will return `null` for both the `pathname()` and | ||
`hash()` methods. | ||
#### Hash links | ||
@@ -103,0 +109,0 @@ |
@@ -31,2 +31,4 @@ var test = require('tape'); | ||
'<span id="no-anchor">No anchor</span>', | ||
'<a id="local-blank" href="/local/page/1" target="_blank">Local Blank</a>', | ||
'<a id="local-blank-hash" href="#modal2" target="_blank">Local Blank Hash</a>', | ||
].join(''); | ||
@@ -71,4 +73,5 @@ document.body.appendChild(container); | ||
var noAnchor = $('no-anchor'); | ||
var localBlank = $('local-blank'); | ||
t.plan(7); | ||
t.plan(8); | ||
@@ -82,2 +85,3 @@ t.equal(localLinks.pathname(a), '/local/page/1'); | ||
t.equal(localLinks.pathname(noAnchor), null); | ||
t.equal(localLinks.pathname(localBlank), null); | ||
@@ -130,10 +134,13 @@ t.end(); | ||
var globalHash = $('global-hash'); | ||
var targetBlankHash = $('local-blank-hash'); | ||
t.plan(5); | ||
t.plan(7); | ||
t.equal(localLinks.pathname(hash), null); | ||
t.equal(localLinks.pathname(emptyHash), null); | ||
t.equal(localLinks.pathname(targetBlankHash), null); | ||
t.equal(localLinks.hash(hash), '#modal'); | ||
t.equal(localLinks.hash(emptyHash), '#'); | ||
t.equal(localLinks.hash(targetBlankHash), null); | ||
@@ -140,0 +147,0 @@ t.equal(localLinks.hash(globalHash), null); |
19511
323
126