Skip to content
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

Add support for modVal : '*' in declMod #1374

Closed
tadatuta opened this issue Jun 16, 2016 · 1 comment
Closed

Add support for modVal : '*' in declMod #1374

tadatuta opened this issue Jun 16, 2016 · 1 comment
Assignees
Milestone

Comments

@tadatuta
Copy link
Member

Used for example in https://github.com/bem/bem-components/blob/v3/common.blocks/button/_togglable/button_togglable.js#L12 or https://github.com/bem/bem-components/blob/v3/common.blocks/popup/_target/popup_target.js#L31

modules.define('b1', ['i-bem-dom'], function(provide, bemDom) {

provide(bemDom.declBlock(this.name, {
    m1: function() {
        console.log('initial m1');
    },
    m1_v1: function() {
        console.log('initial m1_v1');
    }
}));

});

modules.define('b1', function(provide, B1) {

provide(B1.declMod({ modName: 'm1' }, {
    m1: function() {
        console.log('overriden m1');
    }
}));

});

modules.define('b1', function(provide, B1) {

provide(B1.declMod({ modName: 'm1', modVal: 'v1' }, {
    onSetMod: {
        js: {
            inited: function() {
                this.m1();
                this.m1_v1();
            }
        }
    },
    m1_v1: function() {
        console.log('overriden m1_v1');
    }
}));

});

Expected: overriden m1 overriden m1_v1.
Actual result: initial m1 overriden m1_v1.

@tadatuta tadatuta added this to the 4.0 milestone Jun 16, 2016
@veged veged added the wontfix label Jun 17, 2016
@veged veged closed this as completed Jun 17, 2016
@veged veged removed the wontfix label Jun 17, 2016
@veged
Copy link
Member

veged commented Jun 17, 2016

we change semantic of omitted modVal accordingly to setMod (if no modVal it's short cut for modVal : true)

so we need to add support for B1.declMod({ modName: 'm1', modVal: '*' }, as in onSetMod

@veged veged reopened this Jun 17, 2016
@veged veged changed the title [v4] Impossible to declare wildcard modifier Add support for modVal : '*' in declMod Jun 17, 2016
dfilatov added a commit that referenced this issue Jun 20, 2016
Add support for `modVal : '*'` in `declMod` (closes #1374)
@narqo narqo closed this as completed Jun 21, 2016
@narqo narqo removed the in progress label Jun 21, 2016
@dfilatov dfilatov mentioned this issue Aug 18, 2016
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants