Skip to content

Replace all spaces and quotes in waypoint sym class name#308

Open
polybjorn wants to merge 1 commit into
Raruto:masterfrom
polybjorn:fix-waypoint-classname-replace-all
Open

Replace all spaces and quotes in waypoint sym class name#308
polybjorn wants to merge 1 commit into
Raruto:masterfrom
polybjorn:fix-waypoint-classname-replace-all

Conversation

@polybjorn
Copy link
Copy Markdown

@polybjorn polybjorn commented May 26, 2026

Chaining .replace(' ', '-').replace('"', '').replace("'", '') only handles the first occurrence of each character. A waypoint named My place's home becomes className My-place's home instead of my-places-home, and CSS rules keyed on the cleaned name miss the marker.

Switching each call to a /g regex:

sym    : (sym ?? name).replace(/ /g, '-').replace(/"/g, '').replace(/'/g, '').toLowerCase(),

Found by CodeQL on a downstream project that vendors leaflet-elevation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant