From 2985126921863ae42618d3ac9b144c7b3c9c2098 Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Tue, 3 Jan 2017 22:06:35 +0200
Subject: [PATCH] Fix lightbox error caused by missing href (#875)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- Fixed an error caused by lightbox when checking for href in attributes in _constrainLink and the a element doesn’t have a href (e.g. the confirmation links in the ”Empty Book Bag” button).
---
 themes/bootstrap3/js/lightbox.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/themes/bootstrap3/js/lightbox.js b/themes/bootstrap3/js/lightbox.js
index f15a1a972b6..cafc872d7e4 100644
--- a/themes/bootstrap3/js/lightbox.js
+++ b/themes/bootstrap3/js/lightbox.js
@@ -198,7 +198,9 @@ VuFind.register('lightbox', function Lightbox() {
    * data-lightbox-title = Lightbox title (overrides any title the page provides)
    */
   _constrainLink = function constrainLink(event) {
-    if (typeof $(this).data('lightboxIgnore') != 'undefined' || this.attributes.href.value.charAt(0) === '#') {
+    if (typeof $(this).data('lightboxIgnore') != 'undefined'
+      || typeof this.attributes.href === 'undefined' || this.attributes.href.value.charAt(0) === '#'
+    ) {
       return true;
     }
     if (this.href.length > 1) {
-- 
GitLab