bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#69132: [ELPA] Remove jQuery from elpa.gnu.org


From: Stefan Monnier
Subject: bug#69132: [ELPA] Remove jQuery from elpa.gnu.org
Date: Wed, 14 Feb 2024 18:05:47 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

> 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@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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]