-
Notifications
You must be signed in to change notification settings - Fork 2
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
Dropping the parent modifier #4
Comments
Kill parent modifiers. BEM doesn't work like that. |
If you want to add a parent modifier, then the If you want to change some property of the parent (Block in BEM) in relation to its surrounding layout, then creating a new variation with a parrent modifier |
Yeah, I think we should go for simplicity. Example Documentation: |
There is an issue with pseudo selectors: This:
compiles to: .object--modifier,
.object--modifier .object { } That would also mean that this:
compiles to: .object--modifier:hover,
.object--modifier .object:hover {
outline: 1px solid red;
} This would add the outline to both elements if added to a parent element. Solution could be to scope the first modifier to its object: .object.object--modifier:hover,
.object--modifier .object:hover {
outline: 1px solid red;
} Now the hover styles will only be active for modifiers that are on the object or for the object itself being nested under this modifier. |
This is what the CSS the compiler would currently put out:
Both override the
.object
styles: modifiers come after the object styles and parentmodifier have a higher specificity. The difference is their usage:So the question is if this difference in usage is helpful in some way. If not we could kill parent modifiers and alter modifiers so that they can be used in both ways.
Usage:
Is there any advantage to have seperate modifiers? Any use case where this is more clear than just using one modifier?
The text was updated successfully, but these errors were encountered: