From 89f1bb7d2a09d6046978287fd7e2c676f88de339 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Tue, 6 Apr 2021 00:36:28 +0200 Subject: [PATCH] FIX: with vanilla js .href and getAttribute("href") are not equal (#12609) With a link having an empty href: `foo` doing `element.href` will give you the URL of the document, to get the same behavior than `$(element).attr("href")` and get "" you need to do `element.getAttribute("href")` --- app/assets/javascripts/discourse/app/lib/intercept-click.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/lib/intercept-click.js b/app/assets/javascripts/discourse/app/lib/intercept-click.js index 62563737603..7c807456b29 100644 --- a/app/assets/javascripts/discourse/app/lib/intercept-click.js +++ b/app/assets/javascripts/discourse/app/lib/intercept-click.js @@ -22,7 +22,7 @@ export default function interceptClick(e) { } const currentTarget = e.currentTarget; - const href = currentTarget.href; + const href = currentTarget.getAttribute("href"); if ( !href ||