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

Escaping selector strings #16

Closed
jamesjjk opened this issue Dec 20, 2017 · 5 comments
Closed

Escaping selector strings #16

jamesjjk opened this issue Dec 20, 2017 · 5 comments

Comments

@jamesjjk
Copy link

@tizmagik

Hey you should consider also escaping selector strings:

/* eslint no-useless-escape:0 */
const buildSelector = obj =>
  Object.keys(obj)
    .map(k => {
      const cnt = obj[k].replace(/["\\]/g, '\\$&');
      return `[${k}="${cnt}"]`;
    })
    .join('');

export default buildSelector;
@tizmagik
Copy link
Owner

Good call, yes. Would you be up for submitting a PR?

@jamesjjk
Copy link
Author

I have provided a PR for both #14 and Escaping strings. Please note that the build directory is included

@tizmagik
Copy link
Owner

tizmagik commented Dec 26, 2017

@jamesjjk I left the escaping out in the recent PR. I wanted to make sure I understand the use case for this first and have a test for it. Do you have an example of a real world use case you hit for this? Also happy to accept a separate PR if you’re up for it.

Thanks!

@jamesjjk
Copy link
Author

@tizmagik Use case is for example a title with a double quote mark.

@tizmagik
Copy link
Owner

This is now fixed with the latest v3.0.0 release. Please feel free to open a new issue if there's still any problems.

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

No branches or pull requests

2 participants