Closed belozer closed 6 years ago
Bug case
const Mixin = bemDom.declMixin({ myProp : 'test' }); Block = bemDom.declBlock('block', [Mixin]); Block.prototype.findChildBlock // undefined
but
const Mixin = bemDom.declMixin({ myProp : 'test' }); Block = bemDom.declBlock('block', [bemDom.Block, Mixin]); Block.prototype.findChildBlock // function
After add code (This is the draft version of the solution. It remains to do right now.)
/** * Declares DOM-based block and creates block class * @param {String|Function} blockName Block name or block class * @param {Function|Array[Function]} [base] base block + mixes * @param {Object} [props] Methods * @param {Object} [staticProps] Static methods * @returns {Function} Block class */ declBlock : function(blockName, base, props, staticProps) { if(!base || (typeof base === 'object' && !Array.isArray(base))) { staticProps = props; props = base; base = typeof blockName === 'string'? entities[blockName] || Block : blockName; } // added code start base || (base = entities[blockName] || Block); Array.isArray(base) || (base = [base]); if(!base[0].__bemEntity) { base = base.slice(); base.unshift(entities[blockName] || Block); } // added code end return bem.declBlock(blockName, base, props, staticProps); },
Block = bemDom.declBlock('block', [Mixin]); Block.prototype.findChildBlock // function
P.S. A problem can also be with elements
+ @veged
Bug case
but
After add code (This is the draft version of the solution. It remains to do right now.)
P.S. A problem can also be with elements