-
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
Fixes #3023: Add style support for css selectors type [foo~=bar]. #3067
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
CLAs look good, thanks! |
@adelarosab would you mind adding a test for this functionality? @nazar-pc would you mind reviewing this? Thanks!!!! ✨ |
Yeah, you caught me adding test for this. |
I'm having a problem with my nodejs version. I cannot test in my local machine. Sorry. |
LGTM 👍 |
Hi @JeremybellEU, Nope, it doesn't break anything. You can test exactly same case you did with the jsbin from #3023. Regards Edit: Your first screenshot shows regexp is fine. I think what we are looking with this regexp is try to find split points. As you can see in the screenshot, you see 2 "selectors" which is okay. Your regexp is totally accurate but I guess they've chosen to simplify it for performance issues. |
Hm I checked your PR locally and I am indeed unable to reproduce what I expected. When I output the value of
the console output is After some more checking, it replaces |
Hi @JeremybellEU, I haven't made this code. I'm not 100% sure if the purpose of regexp was match everything. The only one who can answer that question is @sorvell. I suppose @samccone or @nazar-pc, could bring light to this. I dare to guess you are right. The code still works because they analyse selectors just for host replacement purposes. Edit: One more correct regexp would be Edit2: I'm not sure what happens with the performance once this regexp is added. @samccone, is there a stress test? |
This change seems ok to me, but @sorvell should really take a look |
I don't think this regex change will be sufficient. The problem is that We also don't have a sibling combinator test or this change would have made it fail! So we need to add a test for this as well. Sorry for the delay. If you're still willing to work on this that'd be great. Otherwise we'll close this PR and put #3023 back in our queue. |
I'll do it ;) Also i'm worry about performance because the regex we are looking for increase complexity a lot |
Well, talking about performance it is better to write some simple benchmark to measure what difference we are talking about. And how it affects component's performance in general. |
Fixed via #3413. Thanks! |
It was a problem with css separators. It was just looking for ~ as separator but there is a possibility to use ~ as part of an attribute css selector.
Edit: http://www.w3.org/TR/css3-selectors/