Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue when using numeric ids #125

Merged
merged 3 commits into from
Feb 26, 2025
Merged

Fix issue when using numeric ids #125

merged 3 commits into from
Feb 26, 2025

Conversation

botandrose
Copy link
Collaborator

@botandrose botandrose commented Feb 26, 2025

As described in #123, its possible to use numeric ids, e.g. <hr id="1">, which is legal, but discouraged. Idiomorph assumes that all ids are valid CSS selectors when prepended with #, but #1 is not a valid css selector, so we get a crash.

We can work around this by switching the selector from #${id} to [id="${id}"], as suggested by @ksbrooksjr , and npm run perf v0.7.2 on this branch shows no detectable difference in perf.

Closes #123

@botandrose botandrose merged commit 4772ef3 into main Feb 26, 2025
12 checks passed
@botandrose botandrose deleted the numeric-id-bug branch February 26, 2025 18:47
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.

SyntaxError: '#1' is not a valid selector.
2 participants