-
Notifications
You must be signed in to change notification settings - Fork 90
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
Namespaces not considered a valid selector #18
Comments
Hi Sorry I forgot to say thanks for CSS Selector Generator, it has saved me a lot of time. I'd done everything previously with XPath and it would have taken me ages to deal with a problem where I needed the CSS selectors instead. The code seems to be here, line 53 onwards. Seems like the tags need to be sanitized, using the work you've already done for IDs.
I'm not as great with regex as I should be. |
@tomgallagher Thanks for the report. I have created a new build that should work fine with namespaced tags. |
Hi thanks for sorting this out. I've tested it on the previous problem and it sailed through. I've got another message of the same type, slightly different problem.:
Is the hyphen an invalid character in CSS selection? If so, is that also in need of being sanitized? |
@tomgallagher Class name can not start with a number. So |
@fczbkk Just to clarify, |
So I'm getting this number issue sporadically and it's causing me a few problems. For the time being I've taken the class tag out of the CSS selector generator options. Would it solve the problem to always refer to the class using the longhand |
So at line 97, you could replace with ? |
@tomgallagher Yes. But that would return attribute selector, instead of class selector. Which means I would have to change some code down the stream, when constructing the whole selector. Also, it would mess with browser compatibilities of generated selectors. So I'd rather not do that now. |
OK thanks for taking a look. |
Resurfacing an old thread, is it possible to do some validation in testSelector/testUniqueness to determine whether the class name is valid as a css selector so those functions can return false rather than causing exception (so that hopefully it could recover and find another unique css selector that is valid) In both functions, it would change those querySelectorAll lines to something like
or
|
@tabjsina There's new version ( Have a look at the new version. If you still encounter errors or invalid selectors, please create a new issue. Thank you. |
That's great. I'll take a look as well. Any chance for a browser build as well as npm? |
@tomgallagher You can get it at NPM: |
Hi
I've come across a problem with namespaced html tags, where
<h:section>
is causing a problem.Any ideas about where I should be looking in your code to make allowances for namespaces?
Thanks
Tom
The text was updated successfully, but these errors were encountered: