"Using elements within elements is not recommended by the BEM methodology." - that he, nothing more, nothing less.
Regarding the basic naming structure, Smashing Mag has an excellent tree shape showing how this should be done:
<b:page> <b:head> <b:menu> ... </b:menu> <e:column> <b:logo/> </e:column> <e:column> <b:search> <e:input/> <e:button>Search</e:button> </b:search> </e:column> <e:column> <b:auth> ... </b:auth> <e:column> </b:head> </b:page>
Which transforms nicely in the following JSON format:
{ block: 'page', content: { block: 'head', content: [ { block: 'menu', content: ... }, { elem: 'column', content: { block: 'logo' } }, { elem: 'column', content: [ { block: 'search', content: [ { elem: 'input' }, { elem: 'button', content: 'Search' } ] } ] }, { elem: 'column', content: { block: 'auth', content: ... } } ] } }
Personally, I would recommend using your second version - in the third, the relationship / dependency between ul and tags does not appear in class names. Well, maybe you have already solved this in the last 2 years, but maybe someone similarly lost in the correct BEM syntax, will find this answer useful ...
Edward munch
source share