Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

guard against links not having a href

  • Loading branch information...
commit 8a8618685e0a0679ce724788e6e2c1c8d5b1addb 1 parent 70519d8
@substack authored
Showing with 5 additions and 2 deletions.
  1. +4 −1 index.js
  2. +1 −1  package.json
View
5 index.js
@@ -36,10 +36,13 @@ Swoop.prototype.scan = function (element) {
function wrap (link) {
link.addEventListener('click', function (ev) {
+ var href = link.getAttribute('href');
+ if (!href) return;
+
if (ev && typeof ev.preventDefault === 'function') {
ev.preventDefault();
}
- var name = link.getAttribute('href').replace(/^#/, '');
+ var name = href.replace(/^#/, '');
if (name === '_back') {
self.back();
}
View
2  package.json
@@ -1,6 +1,6 @@
{
"name" : "swoop",
- "version" : "0.1.8",
+ "version" : "0.1.9",
"description" : "slide around html elements",
"main" : "index.js",
"directories" : {
Please sign in to comment.
Something went wrong with that request. Please try again.