Skip to content

Commit

Permalink
i-bem-dom: setMod doesn't add css class if blocks on the same DOM nod…
Browse files Browse the repository at this point in the history
…e have overlapping end parts in their names

fix #1090
port #1092 to v3
  • Loading branch information
Vladimir Varankin committed Jul 13, 2015
1 parent add6968 commit e685e88
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion common.blocks/i-bem-dom/i-bem-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ var BemDomEntity = inherit(/** @lends BemDomEntity.prototype */{

(oldModVal === true?
classRE.test(className) :
className.indexOf(classPrefix + MOD_DELIM) > -1)?
(' ' + className).indexOf(' ' + classPrefix + MOD_DELIM) > -1)?
this.className = className.replace(
classRE,
(needDel? '' : '$1' + modClassName)) :
Expand Down
9 changes: 8 additions & 1 deletion common.blocks/i-bem-dom/i-bem-dom.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,18 @@ describe('i-bem-dom', function() {
beforeMods : { m6 : true, m7 : 'v7' },
afterCls : 'block i-bem block_js_inited block_m1_v1 block_m2_v2 block_m3 block_m4_v4 block_m5',
mods : { m1 : 'v1', m2 : 'v2', m3 : true, m4 : 'v4', m5 : true, m6 : false, m7 : '' }
},
{
beforeMods : { m6 : true, m7 : 'v7' },
afterCls : 'block bla-block bla-block_m3 bla-block_m1_v1 i-bem block_js_inited block_m1_v1 block_m2_v2 block_m3 block_m4_v4 block_m5',
mods : { m1 : 'v1', m2 : 'v2', m3 : true, m4 : 'v4', m5 : true, m6 : false, m7 : '' },
mix : { block : 'bla-block', mods : { m3 : true, m1 : 'v1' } }
}
].forEach(function(data) {
var block = (rootNode = createDomNode({
block : 'block',
mods : data.beforeMods
mods : data.beforeMods,
mix : data.mix
})).bem(Block);

objects.each(data.mods, function(modVal, modName) {
Expand Down

0 comments on commit e685e88

Please sign in to comment.