GNU bug report logs - #69132
[ELPA] Remove jQuery from elpa.gnu.org

Previous Next

Package: emacs;

Reported by: Philip Kaludercic <philipk <at> posteo.net>

Date: Wed, 14 Feb 2024 19:43:01 UTC

Severity: normal

Done: Philip Kaludercic <philipk <at> posteo.net>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 69132 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Philip Kaludercic <philipk <at> posteo.net>
Cc: 69132 <at> debbugs.gnu.org
Subject: Re: bug#69132: [ELPA] Remove jQuery from elpa.gnu.org
Date: Wed, 14 Feb 2024 18:05:47 -0500
> I was recently surprised to see that elpa.gnu.org uses a jQuery library,
> where it really isn't necessary.  Re-implementing the same functionality
> can be done in a few more lines of plain Javascript, without the need
> for any minified code.  Tested with relatively recent versions of
> Firefox and Chromium, so perhaps it would be nice if someone with an
> older browser could check if I didn't make any bold assumptions. 

Works for me, but I'm not using an "older browser" 🙁

> diff --git a/html/javascript/package-search.js b/html/javascript/package-search.js
> index 47134045eb..92f29703a3 100644
> --- a/html/javascript/package-search.js
> +++ b/html/javascript/package-search.js
> @@ -1,6 +1,35 @@
> -$(document).ready(function() {
> -	$('table').filterTable({
> -		label: '',
> -		placeholder: 'Search packages...'
> -	});
> +window.addEventListener("load", function (event) {
> +	const table = document.getElementById("packages");
> +
> +	const search = document.createElement("input");
> +	search.setAttribute("placeholder", "Search packages...");
> +	search.setAttribute("type", "search");
[...]

I know very little about Javascript, but I'm curious: can't we add the
`input` element directly in the HTML file, and skip those first 4 lines or so?

> diff --git a/html/layout.css b/html/layout.css
> index 4f5c50d393..434220f8c1 100644
> --- a/html/layout.css
> +++ b/html/layout.css

A rationale/description of this part of the change would be welcome.

> From 73a9335634f54b71e9723047f327cf782cfb7244 Mon Sep 17 00:00:00 2001
> From: Philip Kaludercic <philipk <at> posteo.net>
> Date: Wed, 14 Feb 2024 20:37:37 +0100
> Subject: [PATCH] Update HTML generation for new filter implementation
>
> ---
>  elpa-admin.el | 27 +++++++++++----------------
>  1 file changed, 11 insertions(+), 16 deletions(-)

Same here.


        Stefan





This bug report was last modified 1 year and 87 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.