From b1a48981ef127e8e9eaff6bbff1418de07967666 Mon Sep 17 00:00:00 2001 From: Mathias Schreck Date: Mon, 12 Dec 2016 17:08:21 +0100 Subject: [PATCH] Check if href exists before accessing it (#5281) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I got a lot of errors in Firefox 50 `TypeError: $(...).attr(...) is undefined nodebb.min.js:25167:24` which points exactly to that line I’ve changed. Since HTML5 `href` is not a required attribute of an `a` tag. We have a couple of links without `href` and every time you click it you will get this error. --- public/src/ajaxify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index a990e08757..3c59b54408 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -366,7 +366,7 @@ $(document).ready(function () { } // Default behaviour for rss feeds - if (internalLink && $(this).attr('href').endsWith('.rss')) { + if (internalLink && $(this).attr('href') && $(this).attr('href').endsWith('.rss')) { return; }