From cd39c267b5120da9cf15f15adf16e221c0cfedf2 Mon Sep 17 00:00:00 2001 From: David Lynch Date: Fri, 28 Jun 2024 10:17:27 -0500 Subject: [PATCH] Permalink copying: use currentTarget to avoid conflicts with userscripts Bug: T368701 Change-Id: I70b1cbf8aaf917ed843f003eec7bbd61db39ecc7 --- modules/permalinks.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/permalinks.js b/modules/permalinks.js index ecdb4b237..55b60e73b 100644 --- a/modules/permalinks.js +++ b/modules/permalinks.js @@ -1,7 +1,9 @@ function init( $pageContainer ) { $pageContainer.find( '.ext-discussiontools-init-timestamplink' ).on( 'click', ( e ) => { // Try to percent-decode the URL, so that non-Latin characters don't look so ugly (T357021) - let link = e.target.href; + // Use currentTarget rather than target to avoid conflicts with userscripts that do their + // own timestamp-wrapping. (T368701) + let link = e.currentTarget.href; try { // decodeURI() may throw const decodedLink = decodeURI( e.target.href );