-
-
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
CSS Attribute selector should support |= and ~= #620
Comments
This is definitely something we would love to support. There is currently a lot of work happening to refactor how we parse CSS and nodes internally. This will be a roadmap item but may take a bit to get to. I work in the same world with mangled class names. They way I handle it is by having it my build system not mangle at all within the tests. You could try and refactor your build system in that way for now. Or you could import the CSS files and reference them the same way you assign the className values |
Yes, that's what we did eventually. We got rid of mangling in test. Have you thought about using a CSS selector engine like Sizzle instead of writing your own? |
I just left almost the same comment here #595 (comment) |
Here is another example of requiring <div data-test="item"></div>
<div data-test="item item-active"></div>
<div data-test="item item-promoted"></div>
... And we'd like to use selectors such as |
I believe this is covered by v3; @aweary, can you confirm? |
@ljharb the infrastructure is there, but this still needs to be implemented. I'll be sending a PR for this today. |
Enzyme support for this would be awesome. I'm currently using Material UI, which mangles classes everywhere. For mangled classes, most people would be interested in:
Here's the full reference from W3. |
There's an open PR for this: #1157 |
Added in #1157. |
According to W3C spec an attribute selector can have
|=
adn~=
for matching value of the attribute.Example:
'[class|="someClass"]'
Why this is important and useful
CSS modules can append random strings at the end of css classes to "mangle" them. In test, we want to test for existence of classes without knowing the mangled class. Above example class can be
someClass---AbCd123
.The text was updated successfully, but these errors were encountered: