bem-site / bem-method

BEM — a methodology how to develop web projects applicable for any technology
http://bem.info
605 stars 176 forks source link

BEMJSON: `elemMods`, do we really need it? #250

Closed qfox closed 8 years ago

qfox commented 9 years ago

As @tadatuta said: It's made for consistency with template engines. I can say that I didn't see atm a real reason why these private template things exposed to end-user of BEMJSON format.

I feel that a lot of tools now using this (at least bem-xjst). But is there real requirement to differentiate mods with elemMods?

qfox commented 9 years ago

/cc @veged

tadatuta commented 9 years ago

@zxqfox

sure, it's real requirement and not something internal:

block('b1').elem('e1').content();
block('b1').mod('m1', 'v1').elem('e1').content();
block('b1').elem('e1').elemMod('m1', 'v1').content();
block('b1').mod('m1', 'v1').elem('e1').elemMod('m1', 'v1').content();

will all match different nodes.

qfox commented 9 years ago

You talking about XJST specific things. Let's rewrite it:

block('b1').elem('e1').content();
block('b1').mod('m1', 'v1').elem('e1').content();
block('b1').elem('e1').mod('m1', 'v1').content();
block('b1').mod('m1', 'v1').elem('e1').mod('m1', 'v1').content();

Still all the same (just mod used instead of elemMod inside elem). It's a xjst trouble, not bemjson format itself.

tadatuta commented 9 years ago

@zxqfox

block('b1').mod('m1', 'v1').elem('e1').mod('m1', 'v1').content();

:(

qfox commented 9 years ago

@tadatuta Is it possible:

elemMod('v1', 'm1').mod('m1', 'v1').elem('e1').block('b1').content();

? Does somebody use it?

tadatuta commented 9 years ago

@zxqfox e.g.

elemMod('v1', 'm1')(
   content()(),
   mod('m1', 'v1').content()()
)
qfox commented 9 years ago

@tadatuta Satanic thing. What does it means?

tadatuta commented 9 years ago

set some content for b1__e1_v1_m1 when it's inside b1 without modifiers and something else for same element with the same modifier but in case it's inside b1_m1_v1

qfox commented 9 years ago

So it's semantically the same as:

block('b1')(
  elem('e1).elemMod('v1', 'm1').content()(),
  mod('m1', 'v1').elem('e1').elemMod('v1', 'm1').content()()
)

?

Don't see why we need separate elemMod.

qfox commented 9 years ago

@tadatuta Oh, btw. It's a good example of usage ugly cascade in BEMHTML :smirk_cat:

tadatuta commented 9 years ago

@zxqfox it's absolutely the same example as

.my-block_state_active .my-block__elem
{
    color: red;
}
qfox commented 9 years ago

@tadatuta Nope, actually. Your example is:

.block__elem_v1_m1 {
}
.block__elem_v1_m1 :inside?(.block_m1_v1) {
)