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

Possible issue with selector '#.identifier' #18

Closed
tmpfs opened this issue Mar 11, 2017 · 3 comments
Closed

Possible issue with selector '#.identifier' #18

tmpfs opened this issue Mar 11, 2017 · 3 comments
Labels

Comments

@tmpfs
Copy link

tmpfs commented Mar 11, 2017

When an id selector contains a period I get a runtime error here:

https://github.com/fb55/css-what/blob/master/index.js#L97

Such as (truncated for brevity):

TypeError: Cannot read property '0' of null
    at getName (/home/muji/git/makestatic/compiler/packages/auto-title/node_modules/css-what/index.js:97:36)
    at parseSelector (/home/muji/git/makestatic/compiler/packages/auto-title/node_modules/css-what/index.js:145:13)
    at parse (/home/muji/git/makestatic/compiler/packages/auto-title/node_modules/css-what/index.js:82:13)
    at Function.compileUnsafe (/home/muji/git/makestatic/compiler/packages/auto-title/node_modules/css-select/lib/compile.js:33:15)
    at Function.select [as selectOne] (/home/muji/git/makestatic/compiler/packages/auto-title/node_modules/css-select/index.js:20:51)
...

As browsers handle this fine I am wondering whether it is legal to have a period in an id as far as selectors go.

Can you advise? If you feel it's worth patching I am happy to give it a shot and submit a PR.

@fb55 fb55 added the bug label Apr 2, 2017
@fb55
Copy link
Owner

fb55 commented Apr 2, 2017

This is definitely a bug, for now escaping the period should fix this.

@ghost
Copy link

ghost commented Oct 1, 2018

Hello,

This bug is it fix ? Because i found a similar problem i think.

Thank you

@fb55
Copy link
Owner

fb55 commented Oct 2, 2018

This wasn’t fixed. Feel free to take a stab at it!

@fb55 fb55 closed this as completed in 03d0fe8 May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants