-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add [prop='foo']
CSS syntax
#4
Comments
Just an update: it looks like https://github.com/chrisdickinson/cssauron could potentially be of use here... |
Could this extend to event handler keys? Like if I want to find the element that has my click handler. ie, instance.find('[onClick]'); |
@blainekasten I'm hoping we can extend it beyond CSS in a way that makes sense and is useful without bastardizing the CSS spec. |
Awesome. Is anyone internally working on this one yet? If not, I may take a stab at it. |
@blainekasten not yet. Stab away! |
It might also be nice to have a different syntax, or a different method, for event handlers, so an actual HTML attribute |
Do you have a use case where someone uses the browsers |
No, of course I don't have a use case :-) but the fact that it may conflict is a good reason not to create a future footgun, when there's lots of syntax options available that aren't otherwise valid querySelector syntax. |
Thinking about it though, since they are just keys of an object ( You could do either |
I agree. I don't think there's any concern of conflict here, unless I'm missing something... |
|
I see what you are saying. It's your API so I think that is decision you guys should probably make. I could see arguments for both. On one side, since react is modeling the DOM for us, you could think of props being attributes. Especially from a user perspective who is used to html, it looks like they are writing attributes, so they might guess that the On the other side, |
What would I totally agree it's very unlikely this would become a problem - but it's a trivial thing to prevent before the feature exists, and a much harder thing to clean up if it does become a problem later. |
So, i've been working on this for a day now. I have the property look up of the react node working in shallow rendering. So I either need some guidance on this to find out how to do this, or we're not going to get the API @ljharb is hoping for. Basically, it seems that in shallow rendering we aren't getting access to a rendered version of the component. If that is the case, we can't do I guess I could mock it out somehow with a map. But that might get huge and unwieldly. I guess all this to say, I can make it work if that is the API desired. I personally don't think I would ever need a time where I have to query on the html attribute over the react prop. But I understand your argument also. |
I guess I'm still not sure I see @ljharb's point... which is not to say that it's not a valid one... I'm just not convinced I see a conflict at this point. From the way I see it, we aren't querying HTML nodes... we are querying react nodes. the css In the question that @ljharb posed:
To me it seems the answer is easy: it would find react nodes where the Just like the @blainekasten if you think you have a working PR ready to handle one of these two situations, maybe put it up and we can continue the discussion there with a bit more context regarding the solution? |
#70 is up for discussion. |
+1 for attributes selectors, for what it's worth. I'm not migrating to enzyme for now because of this missing feature. |
Closing as this got merged and is now available in 1.3.x |
No description provided.
The text was updated successfully, but these errors were encountered: