Skip to content
This repository was archived by the owner on Feb 4, 2018. It is now read-only.

Commit 748773a

Browse files
author
blond
committed
fix(belongsTo): should not detect belonging between modifiers
1 parent 6664366 commit 748773a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,10 @@ class BemEntityName {
332332
* @returns {boolean}
333333
*/
334334
belongsTo(entityName) {
335-
return entityName && entityName.id !== this.id && this.id.startsWith(entityName.id) &&
336-
(entityName.type !== 'block' || this.type !== 'elemMod') &&
337-
(!entityName.elem || this.elem === entityName.elem) &&
338-
(!entityName.modName || this.modName === entityName.modName) &&
339-
(!entityName.modVal || entityName.modVal === true || this.modVal === entityName.modVal);
335+
if (entityName.block !== this.block) { return false; }
336+
337+
return entityName.type === TYPES.BLOCK && (this.type === TYPES.BLOCK_MOD || this.type === TYPES.ELEM)
338+
|| entityName.elem === this.elem && (entityName.type === TYPES.ELEM && this.type === TYPES.ELEM_MOD);
340339
}
341340

342341
/**

0 commit comments

Comments
 (0)