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

Escape special IDs #27

Merged
merged 1 commit into from
Mar 13, 2019
Merged

Escape special IDs #27

merged 1 commit into from
Mar 13, 2019

Conversation

merlinoa
Copy link

Escaping the input ids for jQuery selector. Resolves issue #16.

Shiny's bookmarking feature creates an input with an id of ".bookmark". This input id was throwing the following javascript error when used as a jQuery selector

Uncaught Error: Syntax error, unrecognized expression: #._bookmark_
    at Function.fa.error (jquery.min.js:2)
    at fa.tokenize (jquery.min.js:2)
    at fa.select (jquery.min.js:2)
    at Function.fa [as find] (jquery.min.js:2)
    at n.fn.init.find (jquery.min.js:2)
    at new n.fn.init (jquery.min.js:2)
    at n (jquery.min.js:2)
    at show_spinner (spinner.js:5)
    at update_spinner (spinner.js:23)
    at HTMLDocument.<anonymous> (spinner.js:34)

The error was resolved by @andrewsali commit ab4cff1 which escapes jQuery selector special characters. Specifically the "." for the case of the bookmarking issue mentioned above.

Additional detail on the regex used to escape the jQuery selector can be found here: https://stackoverflow.com/questions/2786538/need-to-escape-a-special-character-in-a-jquery-selector-string

@andrewsali andrewsali merged commit 9565546 into master Mar 13, 2019
@andrewsali
Copy link
Collaborator

Thanks!

@keqiang
Copy link

keqiang commented Mar 15, 2019

I think this PR introduces an issue. I will try to make a minimal reproducible example later.

Uncaught TypeError: Cannot read property 'replace' of undefined
at escapeSelector (eval at (jquery.min.js:2), :5:14)
at hide_spinner (eval at (jquery.min.js:2), :17:24)
at update_spinner (eval at (jquery.min.js:2), :31:5)
at HTMLDocument.eval (eval at (jquery.min.js:2), :52:3)
at HTMLDocument.dispatch (jquery.min.js:3)
at HTMLDocument.r.handle (jquery.min.js:3)
at Object.trigger (jquery.min.js:3)
at HTMLDocument. (jquery.min.js:3)
at Function.each (jquery.min.js:2)
at n.fn.init.each (jquery.min.js:2)

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.

None yet

3 participants