These are chat archives for bem/talk

19th
Jul 2014
Egor A. Trubnikov-Panov
@egor-a-trubnikov-panov
Jul 19 2014 13:46
how to change the modifier to mix block ?
Alexej Yaroshevich
@zxqfox
Jul 19 2014 15:35
@egor-a-trubnikov Did you mean {block: 'some', mix: {block: 'another', mods: {a: 1}} ?
@egor-a-trubnikov Sometime there is a difference between block and elem mods. To set modifiers for elements use elemMods. I don't actually remember why it should be separated property, but if you want to know it just ask.
Egor A. Trubnikov-Panov
@egor-a-trubnikov-panov
Jul 19 2014 15:59

@zxqfox I think you misunderstood me.

{    block: "draw-button",
     mix: {
          block: "e-button",
          mods: {
              color: "blue"
                      }
               }
}
BEM.DOM.decl( 'draw-button', {
    onSetMod: {
      'js': {
        'inited': function ()
        {
          this.setMod("disable","true");
        }
      }
    }

How to change the modifier to block "e-button" ?

 this.setMod("disable","true");

this turns to "draw-button_disable_true"

Alexej Yaroshevich
@zxqfox
Jul 19 2014 17:09
Ah. You talking about runtime. I think you're looking for
this.findBlockOn('e-button').setMod(modName, modVal);
Egor A. Trubnikov-Panov
@egor-a-trubnikov-panov
Jul 19 2014 17:41
@zxqfox Thanks.
Alexej Yaroshevich
@zxqfox
Jul 19 2014 17:41
:palm_tree:
Egor A. Trubnikov-Panov
@egor-a-trubnikov-panov
Jul 19 2014 17:47
DOM.decl('submit', {
    onSetMod: {
        'js': {
            'inited': function() {
                this.bindTo('click', this._onClick); // подписка на DOM-событие "click"
            }
        }
    },

    _onClick: function() {
        if(!this.hasMod('disabled')) {
            this.emit('click'); // создание BEM-события "click"
        }
    }
});
.emit('click');
Uncaught TypeError: undefined is not a function
Why this function of unknown?
Alexej Yaroshevich
@zxqfox
Jul 19 2014 18:04
@egor-a-trubnikov Does this should have emit? Not sure.
Egor A. Trubnikov-Panov
@egor-a-trubnikov-panov
Jul 19 2014 18:42
@zxqfox I don't know. Thus it is written in the documentation.
Alexander
@belyanskii
Jul 19 2014 20:06
@egor-a-trubnikov can i see full source? :) it's bem-bl or bem-core? (and version plz.)
Alexander
@belyanskii
Jul 19 2014 20:41
@egor-a-trubnikov if it's bem-bl, you should use .trigger('click')
Egor A. Trubnikov-Panov
@egor-a-trubnikov-panov
Jul 19 2014 20:44
@belyanskii Thanks. I use the bem-bl
Egor A. Trubnikov-Panov
@egor-a-trubnikov-panov
Jul 19 2014 21:11
Is it possible to sign a few blocks to a single event bem?