Skip to content

CSS selector escape function should escape foward slashes #758

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

Closed
schlimmchen opened this issue Jun 27, 2017 · 2 comments
Closed

CSS selector escape function should escape foward slashes #758

schlimmchen opened this issue Jun 27, 2017 · 2 comments

Comments

@schlimmchen
Copy link
Contributor

I am using id attributes with values containing forward slash characters: '/'.

The function presented in https://github.com/jquery/learn.jquery.com/blob/master/page/using-jquery-core/faq/how-do-i-select-an-element-by-an-id-that-has-characters-used-in-css-notation.md should also escape forward slashes, which seems neccessary for the seletor to work:

return "#" + id.replace(/(\/|:|\.|\[|\]|,|=|@)/g, "\\$1")

@dmethvin
Copy link
Member

As of jQuery 3.0 you could also use https://api.jquery.com/jQuery.escapeSelector/ .

Would you like to do a pull request with changes?

@schlimmchen
Copy link
Contributor Author

Would you like to do a pull request with changes?

Well yes, now I did. Took me a while to assign this any priority, but now I'd like my pull request to be discussed and hopefully merged :)

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

No branches or pull requests

2 participants