From d4af6c06e83c1e2f9c573d37cb3904519058ad45 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Fri, 22 Mar 2024 17:23:39 +0000 Subject: [PATCH 1/3] Remove jQuery `.attr` from the commit graph Switched from jQuery `.attr` to plain javascript `.getAttribute` and `.setAttribute` Signed-off-by: Yarden Shoham --- web_src/js/features/repo-graph.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web_src/js/features/repo-graph.js b/web_src/js/features/repo-graph.js index 4fbf95b9d596f..f2c0d78f34ee9 100644 --- a/web_src/js/features/repo-graph.js +++ b/web_src/js/features/repo-graph.js @@ -18,13 +18,13 @@ export function initRepoGraphGit() { window.history.replaceState({}, '', window.location.pathname); } $('.pagination a').each((_, that) => { - const href = $(that).attr('href'); + const href = that.getAttribute('href'); if (!href) return; const url = new URL(href, window.location); const params = url.searchParams; params.set('mode', 'monochrome'); url.search = `?${params.toString()}`; - $(that).attr('href', url.href); + that.setAttribute('href', url.href); }); }); $('#flow-color-colored').on('click', () => { @@ -32,13 +32,13 @@ export function initRepoGraphGit() { $('#flow-color-monochrome').removeClass('active'); $('#git-graph-container').addClass('colored').removeClass('monochrome'); $('.pagination a').each((_, that) => { - const href = $(that).attr('href'); + const href = that.getAttribute('href'); if (!href) return; const url = new URL(href, window.location); const params = url.searchParams; params.delete('mode'); url.search = `?${params.toString()}`; - $(that).attr('href', url.href); + that.setAttribute('href', url.href); }); const params = new URLSearchParams(window.location.search); params.delete('mode'); From 5d11f863f6d45d9d9cdaa0edd7032a8995b1e7d9 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Fri, 22 Mar 2024 17:27:04 +0000 Subject: [PATCH 2/3] different style --- web_src/js/features/repo-graph.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web_src/js/features/repo-graph.js b/web_src/js/features/repo-graph.js index f2c0d78f34ee9..e6a9fed68b0d7 100644 --- a/web_src/js/features/repo-graph.js +++ b/web_src/js/features/repo-graph.js @@ -18,13 +18,13 @@ export function initRepoGraphGit() { window.history.replaceState({}, '', window.location.pathname); } $('.pagination a').each((_, that) => { - const href = that.getAttribute('href'); + const href = that.href; if (!href) return; const url = new URL(href, window.location); const params = url.searchParams; params.set('mode', 'monochrome'); url.search = `?${params.toString()}`; - that.setAttribute('href', url.href); + that.href = url.href; }); }); $('#flow-color-colored').on('click', () => { @@ -32,13 +32,13 @@ export function initRepoGraphGit() { $('#flow-color-monochrome').removeClass('active'); $('#git-graph-container').addClass('colored').removeClass('monochrome'); $('.pagination a').each((_, that) => { - const href = that.getAttribute('href'); + const href = that.href; if (!href) return; const url = new URL(href, window.location); const params = url.searchParams; params.delete('mode'); url.search = `?${params.toString()}`; - that.setAttribute('href', url.href); + that.href = url.href; }); const params = new URLSearchParams(window.location.search); params.delete('mode'); From cca306b91106ab84d1d9f79e298406f86bf733f0 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Fri, 22 Mar 2024 19:17:46 +0000 Subject: [PATCH 3/3] Revert "different style" This reverts commit 5d11f863f6d45d9d9cdaa0edd7032a8995b1e7d9. --- web_src/js/features/repo-graph.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web_src/js/features/repo-graph.js b/web_src/js/features/repo-graph.js index e6a9fed68b0d7..f2c0d78f34ee9 100644 --- a/web_src/js/features/repo-graph.js +++ b/web_src/js/features/repo-graph.js @@ -18,13 +18,13 @@ export function initRepoGraphGit() { window.history.replaceState({}, '', window.location.pathname); } $('.pagination a').each((_, that) => { - const href = that.href; + const href = that.getAttribute('href'); if (!href) return; const url = new URL(href, window.location); const params = url.searchParams; params.set('mode', 'monochrome'); url.search = `?${params.toString()}`; - that.href = url.href; + that.setAttribute('href', url.href); }); }); $('#flow-color-colored').on('click', () => { @@ -32,13 +32,13 @@ export function initRepoGraphGit() { $('#flow-color-monochrome').removeClass('active'); $('#git-graph-container').addClass('colored').removeClass('monochrome'); $('.pagination a').each((_, that) => { - const href = that.href; + const href = that.getAttribute('href'); if (!href) return; const url = new URL(href, window.location); const params = url.searchParams; params.delete('mode'); url.search = `?${params.toString()}`; - that.href = url.href; + that.setAttribute('href', url.href); }); const params = new URLSearchParams(window.location.search); params.delete('mode');