Skip to content

Fix issue when using numeric ids#125

Merged
botandrose merged 3 commits intomainfrom
numeric-id-bug
Feb 26, 2025
Merged

Fix issue when using numeric ids#125
botandrose merged 3 commits intomainfrom
numeric-id-bug

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