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

Attribute selector doesn't work on attributes that have numbers in them #693

Closed
ghost opened this issue Nov 18, 2016 · 5 comments
Closed

Comments

@ghost
Copy link

ghost commented Nov 18, 2016

In ShallowTraversal.js the selector for the attribute doesn't work on attributes that have numbers in them.
const propKey = selector.split(/\[([a-zA-Z-]*?)(=|])/)[1];

Instead, it should be:
const propKey = selector.split(/\[([a-zA-Z-0-9-]*?)(=|])/)[1];

@ljharb
Copy link
Member

ljharb commented Nov 18, 2016

@raduanastases it'd be great if you could file a PR with a test case!

@ljharb
Copy link
Member

ljharb commented Nov 18, 2016

(also, please note that attributes that start with numbers are invalid)

@ghost
Copy link
Author

ghost commented Nov 18, 2016

sure, I'll get to it as soon as possible.

jsmey pushed a commit to jsmey/enzyme that referenced this issue Nov 23, 2016
@jsmey
Copy link

jsmey commented Nov 23, 2016

I made this change and added a test. PR #700

jsmey pushed a commit to jsmey/enzyme that referenced this issue Nov 29, 2016
Throw when attribute selector is invalid

include the selector in the error message
jsmey pushed a commit to jsmey/enzyme that referenced this issue Nov 29, 2016
jsmey pushed a commit to jsmey/enzyme that referenced this issue Nov 30, 2016
Allow numbers in attribute selectors and validate selector

refactored split
@ljharb
Copy link
Member

ljharb commented Sep 26, 2017

Closed in #1086

@ljharb ljharb closed this as completed Sep 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants