From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#69132: [ELPA] Remove jQuery from elpa.gnu.org Date: Thu, 15 Feb 2024 08:12:56 +0000 Message-ID: <87h6iap2lz.fsf@posteo.net> References: <87jzn6g7ep.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20430"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69132@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 15 09:14:05 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1raWsf-00058a-D6 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 15 Feb 2024 09:14:05 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raWsP-0006gN-Rn; Thu, 15 Feb 2024 03:13:50 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raWsJ-0006g4-VA for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 03:13:44 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1raWsJ-0001BT-Lj for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 03:13:43 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1raWsb-0008TX-Pj for bug-gnu-emacs@gnu.org; Thu, 15 Feb 2024 03:14:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 15 Feb 2024 08:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69132 X-GNU-PR-Package: emacs Original-Received: via spool by 69132-submit@debbugs.gnu.org id=B69132.170798480532530 (code B ref 69132); Thu, 15 Feb 2024 08:14:01 +0000 Original-Received: (at 69132) by debbugs.gnu.org; 15 Feb 2024 08:13:25 +0000 Original-Received: from localhost ([127.0.0.1]:53923 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raWs1-0008Sb-C3 for submit@debbugs.gnu.org; Thu, 15 Feb 2024 03:13:25 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:44427) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raWry-0008SL-Na for 69132@debbugs.gnu.org; Thu, 15 Feb 2024 03:13:24 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id E2BB4240029 for <69132@debbugs.gnu.org>; Thu, 15 Feb 2024 09:12:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1707984777; bh=6oi7+lF208XdZVsKQEb+HZ9VqX7wLFP7IVQb/bryTXA=; h=From:To:Cc:Subject:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding:From; b=QmcY6Sm4INSPJQSLVAX7pmyi3rK5UqU0sDm50G1MOpfmTTTN5oJ1zIP2RHQeaf88p sTpZhHwMSHIEqAmY9qWbHuZdunh3xii1h5LYKY03+yH+Lym0efP4DNaBD4nibhGzFN ISRfIFLgUR5+SOFmunG+SNH9++KqePJx88BK+jmSQRCOezS9hNE4MSxQNTILaRZWaU EG41JBVWU3qV0U/3I6tceaMigUFaxbUTc3eTam7nr/gDFSFuhwrBHnsKot+6b72NKe g+MIg2zg15PT6tfi8GUuVR4Me4Gn3PvRDqZLUzvkeeR1Zug/JMXcA8CSt7JOUufMBb Wj0pkkOsktfZg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Tb7943g1Wz6tvm; Thu, 15 Feb 2024 09:12:56 +0100 (CET) In-Reply-To: (Stefan Monnier's message of "Wed, 14 Feb 2024 18:05:47 -0500") OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:280046 Archived-At: Stefan Monnier writes: >> 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.=20 > > Works for me, but I'm not using an "older browser" =F0=9F=99=81 I have a few older machines that I could try it out on. >> 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 =3D document.getElementById("packages"); >> + >> + const search =3D 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 o= r so? Of course, I just replicated what the jquery plugin did. I suppose the idea was to not have a broken search field labelled "Search packages...", if there is no Javascript to make it work in the first place. >> 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 >> 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. The idea is just to not use CSS classes to pinpoint specific Elements in the DOM. That is what IDs are for (ideally the "ID -> elements" map should be injective). I needed that to use document.getElementById in the new script. Should I update the commit messages to explain the change? > > Stefan