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

compile method does not throw error #287

Closed
icsaba opened this issue Jul 22, 2020 · 5 comments
Closed

compile method does not throw error #287

icsaba opened this issue Jul 22, 2020 · 5 comments

Comments

@icsaba
Copy link

icsaba commented Jul 22, 2020

the compile method does not throw an error in case of bad selectors are given.

const cssSelect = require('css-select');
cssSelect.compile("##button"); 

the compile method returns with a function, but an error expected Uncaught Error: Expected name, found ##button

The problem is with the css-what 's latest version where parser method does not throw the error.

@fb55
Copy link
Owner

fb55 commented Sep 10, 2020

This is a consequence of #18. Happy to take suggestions for a middle ground here.

@fb55 fb55 transferred this issue from fb55/css-select Sep 23, 2020
@fb55
Copy link
Owner

fb55 commented Sep 23, 2020

Transferred the issue to the repo that would have to produce the error.

@icsaba css-what (and css-select) are currently more permissive than other CSS engines and would eg. find a <div id="#id"> with a ##id selector. It would be great if you could provide some context on how this is an issue.

@icsaba
Copy link
Author

icsaba commented Sep 25, 2020

we use the compile method to validate css selectors given by the user, and after that we try to find the item in the DOM. (consider something like the browser's item selector) We provide an error if the selector is not valid, and stop the process, but if it says ##something is a valid selector, then neither the user nor we won't see anything on the UI / in the logs.

@fb55 fb55 closed this as completed in 7d1e95b Oct 13, 2020
@fb55
Copy link
Owner

fb55 commented Oct 13, 2020

We now explicitly disallow names starting with #. Please let me know if there are other cases that should be covered.

@icsaba
Copy link
Author

icsaba commented Oct 13, 2020

great, thank you

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

No branches or pull requests

2 participants