{"action":"created","issue":{"url":"https://api.github.com/repos/bem/bem-components/issues/1692","labels_url":"https://api.github.com/repos/bem/bem-components/issues/1692/labels{/name}","comments_url":"https://api.github.com/repos/bem/bem-components/issues/1692/comments","events_url":"https://api.github.com/repos/bem/bem-components/issues/1692/events","html_url":"https://github.com/bem/bem-components/issues/1692","id":112135498,"number":1692,"title":"Dropdown mechanics","user":{"login":"awinogradov","id":982072,"avatar_url":"https://avatars.githubusercontent.com/u/982072?v=3","gravatar_id":"","url":"https://api.github.com/users/awinogradov","html_url":"https://github.com/awinogradov","followers_url":"https://api.github.com/users/awinogradov/followers","following_url":"https://api.github.com/users/awinogradov/following{/other_user}","gists_url":"https://api.github.com/users/awinogradov/gists{/gist_id}","starred_url":"https://api.github.com/users/awinogradov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awinogradov/subscriptions","organizations_url":"https://api.github.com/users/awinogradov/orgs","repos_url":"https://api.github.com/users/awinogradov/repos","events_url":"https://api.github.com/users/awinogradov/events{/privacy}","received_events_url":"https://api.github.com/users/awinogradov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-19T12:36:54Z","updated_at":"2015-10-19T15:23:24Z","closed_at":null,"body":"Давече зашел я в `dropdown`. Моему взору открылся шаблона фрагмент:\r\n``` js\r\nreturn [\r\n    { elem : 'switcher', content : this.ctx.switcher },\r\n    popup\r\n];\r\n```\r\nПошел я `dropdown__switcher` смотреть:\r\n``` js\r\nblock('dropdown').elem('switcher').tag()(false);\r\n```\r\nСижу теперь в раздумьях весь. Почему так? Почему `popup` прокидывается без фейкового шаблона элемента, а свитчер вот нет? Надумал и нашел еще вопрос, отчего не вот так все:\r\n\r\n``` js\r\ncontent()(function() {\r\n    var popup = this.ctx.popup,\r\n        switcher = this.ctx.switcher;\r\n\r\n    if(this.isSimple(popup) || popup.block !== 'popup') {\r\n        popup = { block: 'popup', content: popup };\r\n    }\r\n\r\n    var popupMods = popup.mods || (popup.mods = {});\r\n    popupMods.theme || (popupMods.theme = this.mods.theme);\r\n    popupMods.hasOwnProperty('autoclosable') || (popupMods.autoclosable = true);\r\n\r\n    popupMods.target = 'anchor';\r\n\r\n    popup.mix = this.extend(popup.mix || {}, { block: this.block, elem: 'popup' });\r\n    switcher.mix = this.extend(switcher.mix || {}, { block: this.block, elem: 'switcher' });\r\n\r\n    return [switcher, popup];\r\n})\r\n```\r\n\r\nДалее логично посмотреть на код в `dropdown_switcher_button.js` и `dropdown_switcher_link.js`. После чего возникает вопрос почему это не один универсальный бинд на `dropdown__switcher`?\r\n\r\nГлубинное изучение вопроса дает понять, что `dropdown` заточен на бинд БЭМ-события, что не дает сделать универсальный код. Как быть, как жить, что делать дальше? ;)\r\n"},"comment":{"url":"https://api.github.com/repos/bem/bem-components/issues/comments/149248341","html_url":"https://github.com/bem/bem-components/issues/1692#issuecomment-149248341","issue_url":"https://api.github.com/repos/bem/bem-components/issues/1692","id":149248341,"user":{"login":"dfilatov","id":67957,"avatar_url":"https://avatars.githubusercontent.com/u/67957?v=3","gravatar_id":"","url":"https://api.github.com/users/dfilatov","html_url":"https://github.com/dfilatov","followers_url":"https://api.github.com/users/dfilatov/followers","following_url":"https://api.github.com/users/dfilatov/following{/other_user}","gists_url":"https://api.github.com/users/dfilatov/gists{/gist_id}","starred_url":"https://api.github.com/users/dfilatov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dfilatov/subscriptions","organizations_url":"https://api.github.com/users/dfilatov/orgs","repos_url":"https://api.github.com/users/dfilatov/repos","events_url":"https://api.github.com/users/dfilatov/events{/privacy}","received_events_url":"https://api.github.com/users/dfilatov/received_events","type":"User","site_admin":false},"created_at":"2015-10-19T15:23:24Z","updated_at":"2015-10-19T15:23:24Z","body":"Каким образом, учитывая эти два пункта, ты предлагаешь этого избежать?"}}