bem / bem-components

Set of components for sites development
https://bem.info/libraries/classic/bem-components/6.0.0/
Other
332 stars 86 forks source link

menu: crash on block without content (?) #1320

Closed qfox closed 9 years ago

qfox commented 9 years ago

I have bemjson

{ block : 'menu', content : { block : 'not-menu-item' } }

It doesn't even be rendered and fails with some dirty error in compiled file ;-(

TypeError: Cannot read property '0' of undefined
    at __$b29.iterateItems__$69 (.../index.bemhtml.js:501:46)
    ...

Can we do something with this while we can't build source maps and resolve real filename and real string?

tadatuta commented 9 years ago

@zxqfox I know that's a pain but you may build templates in dev mode and find the very line

qfox commented 9 years ago

@tadatuta I think we should notice in docs that menu supports ONLY objects with content field: https://github.com/bem/bem-components/blob/v2/common.blocks/menu/menu.bemhtml#L18 Or just fix that ;-)

hcodes commented 9 years ago

/cc @innabelaya Лучше добавить в документацию. https://github.com/bem/bem-components/blob/v2/common.blocks/menu/menu.en.md#custom-fields-of-the-block content Array The array of the menu items.

https://github.com/bem/bem-components/blob/v2/common.blocks/menu/menu.ru.md#custom-fields-of-the-block content Array Массив пунктов меню.

qfox commented 9 years ago

@hcodes у нас часто видно assertы ругаются. В случае меню с элементами — может тоже добавим?

hcodes commented 9 years ago

Хорошо, добавлю.

hcodes commented 9 years ago

Fixes #1335

innabelaya commented 9 years ago

@hcodes добавила описание #1336