From 6f8ba35d81d56463296ae9d0a999cebf72c5939d Mon Sep 17 00:00:00 2001 From: Kevin Dew Date: Tue, 17 Jan 2023 21:32:30 +0000 Subject: [PATCH] Update jQuery from 1.12.4 to 3.6.3 Although there are many reasons to motivate an upgrade of such a legacy dependency, the main motivation for this change was that jQuery 1.12 triggers CSP violations on initialisation in Firefox (due to [1] which was removed by jQuery 2.2). The reason this uses such an old version of jQuery is that we (GOV.UK) used to share a version of jQuery across many apps and thus it was scary to update as it was hard to test it's impacts. Since March 2022 [2] Licence Finder has had it's own version of jQuery and thus it is easier to judge the impacts. To determine compatibly with jQuery 3 I ran this through jQuery migrate [3] and fixed the one warning. I also went through and manually tested the code setting breakpoints to check various parts were executed. [1]: https://github.com/jquery/jquery/blob/e09907ce152fb6ef7537a3733b1d65ead8ee6303/src/event/support.js#L7-L20 [2]: https://github.com/alphagov/licence-finder/commit/c384fc507412d57cb8d312dcd3c285c98340fc29 --- app/assets/javascripts/application.js | 2 +- package.json | 2 +- yarn.lock | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index fbe1cff5..5a95bf58 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -13,7 +13,7 @@ $(function() { // $('el:bottom-offscreen') will return true if the element's // bottom box border is off the screen - $.expr.filters['bottom-offscreen'] = function(el) { + $.expr.pseudos['bottom-offscreen'] = function(el) { var $window = $(window), $el = $(el), bottomOfWindow = ($window.scrollTop() + $window.height()), diff --git a/package.json b/package.json index ca0c6d9c..0257825d 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,6 @@ "name": "licence-finder", "license": "MIT", "dependencies": { - "jquery": "1.12.4" + "jquery": "3.6.3" } } diff --git a/yarn.lock b/yarn.lock index 7bc8cf0c..6da19d1a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -jquery@1.12.4: - version "1.12.4" - resolved "https://registry.yarnpkg.com/jquery/-/jquery-1.12.4.tgz#01e1dfba290fe73deba77ceeacb0f9ba2fec9e0c" - integrity sha1-AeHfuikP5z3rp3zurLD5ui/sngw= +jquery@3.6.3: + version "3.6.3" + resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.6.3.tgz#23ed2ffed8a19e048814f13391a19afcdba160e6" + integrity sha512-bZ5Sy3YzKo9Fyc8wH2iIQK4JImJ6R0GWI9kL1/k7Z91ZBNgkRXE6U0JfHIizZbort8ZunhSI3jw9I6253ahKfg==