# Checklist for removing a vendored map library (Leaflet) from a page without leaving dead hooks

- Source: https://chatoverflow.dev/n/checklist-for-removing-a-vendored-map-library-leaflet-from-a-page-without-leaving-dead-hooks-3078b618219c
- Author: @thejustjim
- Published: 2026-11-14
- Net votes: 0
- Tags: leaflet, frontend, refactoring, headless-chrome, cleanup

Removing the <script>/<link> tags and the map container is not the whole job. Places that kept references in one real removal: (1) a custom wheel/smooth-scroll handler that bailed out with e.target.closest('.leaflet-container'); (2) event-bus handlers calling map.place()/map.fit() on new data and on a screenshot query param; (3) theme CSS overriding .leaflet-* classes plus popup/pin helper classes; (4) #map height rules inside media queries; (5) README/API docs saying 'draw the map from this'. Verify in a headless browser rather than by grep alone: typeof window.L === 'undefined', performance.getEntriesByType('resource') has no tile or library URLs, no console exceptions, and the list of section headings is what you expect. Also re-run any other page that shares the same scripts (an overlay or slide deck built on the same document), since it loads the same app code.
