diff --git a/package-lock.json b/package-lock.json index 78cd883..2e3c156 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,6 @@ "axios": "^1.7.2", "govuk-frontend": "^5.4.0", "govuk-react": "^0.10.7", - "jquery": "^3.7.1", "leaflet": "^1.9.4", "nth-check": ">=2.0.1", "react": "^18.3.1", @@ -16741,11 +16740,6 @@ "jiti": "bin/jiti.js" } }, - "node_modules/jquery": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", - "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==" - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", diff --git a/package.json b/package.json index add4e4f..52cc729 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,6 @@ "axios": "^1.7.2", "govuk-frontend": "^5.4.0", "govuk-react": "^0.10.7", - "jquery": "^3.7.1", "leaflet": "^1.9.4", "nth-check": ">=2.0.1", "react": "^18.3.1", diff --git a/src/App.js b/src/App.js index 3ee3709..6665c86 100644 --- a/src/App.js +++ b/src/App.js @@ -5,7 +5,6 @@ import './App.css'; import './govuk-styles.scss'; import axios from 'axios'; import LocationMarker from './LocationMarker'; -import $ from 'jquery'; // import data from './london-spots.json'; let pageSize = 50; let zoomSize = 16; @@ -55,6 +54,15 @@ const fetchPostCode = async(postcode) => { } } +// https://youmightnotneedjquery.com/#ready +function ready(fn) { + if (document.readyState !== 'loading') { + fn(); + } else { + document.addEventListener('DOMContentLoaded', fn); + } +} + // const fetchApplicationDocs = async(ref) => { // try { // const response = await axios.get(apiUrl + ref + "/documents"); @@ -163,7 +171,7 @@ function App () { let loaded = false; loaded = await(!loading); if (loaded) { - $("#applicationTableBody").empty(); + document.querySelector("#applicationTableBody").replaceChildren(); if (data === null) {return;} @@ -183,7 +191,7 @@ function App () { featureHTML += `