fix: don't queryselectorall using exact string#3198
Open
stevekaplan123 wants to merge 1 commit intomasterfrom
Open
fix: don't queryselectorall using exact string#3198stevekaplan123 wants to merge 1 commit intomasterfrom
stevekaplan123 wants to merge 1 commit intomasterfrom
Conversation
yodem
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When users open up refs with apostrophes in their titles (like "Kitzur Ba'al HaTurim on Numbers 10:34:1"), we were querying for the title using apostrophes, thus causing a white screen.
Code Changes
Previously, we called querySelectorAll looking for the exact div where 'data-ref' equals "Kitzur Ba'al HaTurim on Numbers 10:34:1" for example. Instead of querying for the exact string, this fix first queries for all TextRange elements and then filters out the one that matches the exact ref we're looking for. We could have solved this by escaping the apostrophes but I think this is more elegant as it doesn't tie us to a specific ref format. We simply grab the elements on the screen with a 'data-ref' (which is not usually more than 10) and look for the one with the exact string match to the ref the user requested.