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

Unable to parse selectors with numeric values in exponential notation #1155

Closed
aweary opened this issue Sep 26, 2017 · 9 comments
Closed

Unable to parse selectors with numeric values in exponential notation #1155

aweary opened this issue Sep 26, 2017 · 9 comments
Assignees
Labels

Comments

@aweary
Copy link
Collaborator

aweary commented Sep 26, 2017

The parser will fail if you try to do [val=2e8] because it doesn't recognize e as a valid character for numeric constants. I'll work on a fix for rst-selector-parser

@masataka
Copy link

masataka commented Sep 27, 2017

additionally...

import * as React from 'react';
import { shallow } from 'enzyme';
test('Failed to parse selector: #0', () => {
    const Test = () => (<div id="0">text</div>);
    const test = shallow(<Test/>);
    test.find('#0');
});

this Jest test code tells me 'Failed to parse selector: #0'.

@ljharb
Copy link
Member

ljharb commented Sep 27, 2017

@masataka-kurihara that's because "0" is an invalid ID. IDs can not start with numbers.

@masataka
Copy link

Thx, @ljharb . Oh, I usually do with wrong way but this can run under v2.

@ljharb
Copy link
Member

ljharb commented Sep 27, 2017

Then that's a bug in v2 that v3 fixes :-)

@masataka
Copy link

Sounds good.

If you can, I want to tell me by the message how I am wrong.

@ljharb
Copy link
Member

ljharb commented Sep 27, 2017

That's a much harder problem (for a parser to know why your unpsrseable thing is wrong) - I don't think that's going to be practical here.

@masataka
Copy link

No problem, I think it for another one. I have understood. Thank you for your kindness.

@HansWurst90
Copy link

I encountered the same problem and found the reason here, thanks for explaining/pointing it out.
@ljharb
But according to HTML5 Recommendation:

The id attribute specifies its element’s unique identifier (ID).
There are no other restrictions on what form an ID can take; in particular, IDs can consist of just digits, start with a digit, start with an underscore, consist of just punctuation, etc.

@ljharb
Copy link
Member

ljharb commented Jul 6, 2018

Thanks - I believe you're right, and that I was incorrect. I also think that this is now fixed :-)

Please file a new issue if not.

@ljharb ljharb closed this as completed Jul 6, 2018
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

4 participants