Context
js/wall.js and js/glossary.js are the same program twice: fetch JSON, sort, render a list, filter on input, show a count, show an error if the fetch fails. The duplicate escapeHtml is the clearest symptom. A fix to one will not reach the other.
What to change
Files: js/wall.js, js/glossary.js, a new shared file
Requirements:
- Extract the shared behaviour into one module both pages use
- Keep the two pages rendering differently — the card markup is genuinely different and should stay so
- No build step. Plain scripts, loaded with
<script>, as everything else on this site is
- Both pages must behave exactly as they do now
Acceptance criteria
How to verify locally
python3 -m http.server 8000
Then open http://localhost:8000.
Difficulty
Intermediate. Good practice at refactoring without changing behaviour.
New here? Comment /claim on this issue and a bot will assign it to you. Then read CONTRIBUTING.md.
Stuck at any point? Comment here saying what you have tried and where it stopped working — that is not an admission of failure, it is how we find out the instructions were unclear. You can also come to a PR Debug Clinic (Oct 12 or Oct 21).
Context
js/wall.jsandjs/glossary.jsare the same program twice: fetch JSON, sort, render a list, filter on input, show a count, show an error if the fetch fails. The duplicateescapeHtmlis the clearest symptom. A fix to one will not reach the other.What to change
Files:
js/wall.js,js/glossary.js, a new shared fileRequirements:
<script>, as everything else on this site isAcceptance criteria
escapeHtmlexists in exactly one placeHow to verify locally
Then open http://localhost:8000.
Difficulty
Intermediate. Good practice at refactoring without changing behaviour.
New here? Comment
/claimon this issue and a bot will assign it to you. Then read CONTRIBUTING.md.Stuck at any point? Comment here saying what you have tried and where it stopped working — that is not an admission of failure, it is how we find out the instructions were unclear. You can also come to a PR Debug Clinic (Oct 12 or Oct 21).