Skip to content

Possible issue with selector '#.identifier' #18

Closed
@tmpfs

Description

@tmpfs

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.

Activity

fb55

fb55 commented on Apr 2, 2017

@fb55
Owner

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

ghost

ghost commented on Oct 1, 2018

@ghost

Hello,

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

Thank you

fb55

fb55 commented on Oct 2, 2018

@fb55
Owner

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @fb55@tmpfs

        Issue actions

          Possible issue with selector '#.identifier' · Issue #18 · fb55/css-what