{"action":"created","comment":{"url":"https://api.github.com/repos/basisjs/articles/pulls/comments/89514810","pull_request_review_id":10060164,"id":89514810,"diff_hunk":"@@ -1,3 +1,234 @@\n # Роли\n \n-TODO\n+К значимым элементам интерфейса следует добавлять специальные маркеры — роли.\n+Роль — это альтернатива пути в DOM-дереве, дополнительный семантический уровень у элементов.\n+\n+Используя роли, разработчики приобретают удобный инструмент для отслеживания поведения пользователей на сайте (трекинг) и для автоматического тестирования, независимый от классической разметки.\n+\n+## Создание\n+В основном, роли прописываются для элементов, на которых слушаются события (т.е. у которых есть атрибуты с префиксом [event-](https://github.com/basisjs/articles/blob/master/ru-RU/basis.ui_actions.md)), но также могут прописываться для любых других значимых элементов.\n+\n+\n+В шаблоне главный элемент компонента маркируется атрибутом `b:role`. Значение роли всегда приходит из описания компонента (владельца шаблона), это значение специального биндинга.\n+\n+**В шаблоне**\n+```\n+<div class=\"component\" b:role></div>\n+```\n+\n+\n+**Во владельце шаблона** *(упрощенный вариант)*\n+```\n+var component = new Node({\n+     role: 'foo',\n+     template: resource('./template/component.tmpl'),\n+ });\n+```\n+\n+*(определение роли через биндинг)*\n+```\n+var component = new Node({\n+     role: 'foo',\n+     template: resource('./template/component.tmpl'),\n+     binding: {\n+        foo: 'data:foo'\n+ });\n+```\n+\n+\n+**В итоговой разметке**\n+```\n+<div class=\"component\" role-marker=\"foo\"></div>\n+```\n+\n+Второстепенные/вспомогательные элементы могут маркироваться атрибутом `b:role` со значением. Например, если у владельца роль foo и атрибут `b:role=\"bar\"`, то в итоговой разметке у элемента будет роль `foo/bar`.","path":"ru-RU/template/role.md","position":45,"original_position":45,"commit_id":"c377a603e19c7d7f32dc0946a72b0c22c764756c","original_commit_id":"c377a603e19c7d7f32dc0946a72b0c22c764756c","user":{"login":"MammaSonnim","id":5174297,"avatar_url":"https://avatars.githubusercontent.com/u/5174297?v=3","gravatar_id":"","url":"https://api.github.com/users/MammaSonnim","html_url":"https://github.com/MammaSonnim","followers_url":"https://api.github.com/users/MammaSonnim/followers","following_url":"https://api.github.com/users/MammaSonnim/following{/other_user}","gists_url":"https://api.github.com/users/MammaSonnim/gists{/gist_id}","starred_url":"https://api.github.com/users/MammaSonnim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MammaSonnim/subscriptions","organizations_url":"https://api.github.com/users/MammaSonnim/orgs","repos_url":"https://api.github.com/users/MammaSonnim/repos","events_url":"https://api.github.com/users/MammaSonnim/events{/privacy}","received_events_url":"https://api.github.com/users/MammaSonnim/received_events","type":"User","site_admin":false},"body":"Например, если в описании компонента указана роль foo, а в шаблоне прописан атрибут `b:role=\"bar\"`, то в итоговой разметке у элемента будет роль `foo/bar`.","created_at":"2016-11-24T15:17:46Z","updated_at":"2016-11-24T15:17:46Z","html_url":"https://github.com/basisjs/articles/pull/40#discussion_r89514810","pull_request_url":"https://api.github.com/repos/basisjs/articles/pulls/40","_links":{"self":{"href":"https://api.github.com/repos/basisjs/articles/pulls/comments/89514810"},"html":{"href":"https://github.com/basisjs/articles/pull/40#discussion_r89514810"},"pull_request":{"href":"https://api.github.com/repos/basisjs/articles/pulls/40"}}},"pull_request":{"url":"https://api.github.com/repos/basisjs/articles/pulls/40","id":93866443,"html_url":"https://github.com/basisjs/articles/pull/40","diff_url":"https://github.com/basisjs/articles/pull/40.diff","patch_url":"https://github.com/basisjs/articles/pull/40.patch","issue_url":"https://api.github.com/repos/basisjs/articles/issues/40","number":40,"state":"open","locked":false,"title":"add roles","user":{"login":"MammaSonnim","id":5174297,"avatar_url":"https://avatars.githubusercontent.com/u/5174297?v=3","gravatar_id":"","url":"https://api.github.com/users/MammaSonnim","html_url":"https://github.com/MammaSonnim","followers_url":"https://api.github.com/users/MammaSonnim/followers","following_url":"https://api.github.com/users/MammaSonnim/following{/other_user}","gists_url":"https://api.github.com/users/MammaSonnim/gists{/gist_id}","starred_url":"https://api.github.com/users/MammaSonnim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MammaSonnim/subscriptions","organizations_url":"https://api.github.com/users/MammaSonnim/orgs","repos_url":"https://api.github.com/users/MammaSonnim/repos","events_url":"https://api.github.com/users/MammaSonnim/events{/privacy}","received_events_url":"https://api.github.com/users/MammaSonnim/received_events","type":"User","site_admin":false},"body":"- Начала наполнять страницу про роли\r\n\r\n- По поводу замены «представления» на «отображение» — в параграфе противопоставляется логика (в представлении) и отображение (в шаблоне). А в конце внезапно появляется противопоставление логики и представления. В [https://www.slideshare.net/slideshow/embed_code/key/u5T5Q7oZIpPlA2?hostedIn=slideshare&referer=http://www.slideshare.net/basisjs?utm_campaign=profiletracking&amp;utm_medium=sssite&amp;utm_source=ssslideview](этом докладе) это было логично, здесь же читается странно.","created_at":"2016-11-15T22:58:36Z","updated_at":"2016-11-24T15:17:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"42eb55e43e7d1332b7dba9485071246df5d0cd96","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/basisjs/articles/pulls/40/commits","review_comments_url":"https://api.github.com/repos/basisjs/articles/pulls/40/comments","review_comment_url":"https://api.github.com/repos/basisjs/articles/pulls/comments{/number}","comments_url":"https://api.github.com/repos/basisjs/articles/issues/40/comments","statuses_url":"https://api.github.com/repos/basisjs/articles/statuses/c377a603e19c7d7f32dc0946a72b0c22c764756c","head":{"label":"MammaSonnim:master","ref":"master","sha":"c377a603e19c7d7f32dc0946a72b0c22c764756c","user":{"login":"MammaSonnim","id":5174297,"avatar_url":"https://avatars.githubusercontent.com/u/5174297?v=3","gravatar_id":"","url":"https://api.github.com/users/MammaSonnim","html_url":"https://github.com/MammaSonnim","followers_url":"https://api.github.com/users/MammaSonnim/followers","following_url":"https://api.github.com/users/MammaSonnim/following{/other_user}","gists_url":"https://api.github.com/users/MammaSonnim/gists{/gist_id}","starred_url":"https://api.github.com/users/MammaSonnim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MammaSonnim/subscriptions","organizations_url":"https://api.github.com/users/MammaSonnim/orgs","repos_url":"https://api.github.com/users/MammaSonnim/repos","events_url":"https://api.github.com/users/MammaSonnim/events{/privacy}","received_events_url":"https://api.github.com/users/MammaSonnim/received_events","type":"User","site_admin":false},"repo":{"id":73360145,"name":"articles","full_name":"MammaSonnim/articles","owner":{"login":"MammaSonnim","id":5174297,"avatar_url":"https://avatars.githubusercontent.com/u/5174297?v=3","gravatar_id":"","url":"https://api.github.com/users/MammaSonnim","html_url":"https://github.com/MammaSonnim","followers_url":"https://api.github.com/users/MammaSonnim/followers","following_url":"https://api.github.com/users/MammaSonnim/following{/other_user}","gists_url":"https://api.github.com/users/MammaSonnim/gists{/gist_id}","starred_url":"https://api.github.com/users/MammaSonnim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MammaSonnim/subscriptions","organizations_url":"https://api.github.com/users/MammaSonnim/orgs","repos_url":"https://api.github.com/users/MammaSonnim/repos","events_url":"https://api.github.com/users/MammaSonnim/events{/privacy}","received_events_url":"https://api.github.com/users/MammaSonnim/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MammaSonnim/articles","description":"Articles about basis.js","fork":true,"url":"https://api.github.com/repos/MammaSonnim/articles","forks_url":"https://api.github.com/repos/MammaSonnim/articles/forks","keys_url":"https://api.github.com/repos/MammaSonnim/articles/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MammaSonnim/articles/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MammaSonnim/articles/teams","hooks_url":"https://api.github.com/repos/MammaSonnim/articles/hooks","issue_events_url":"https://api.github.com/repos/MammaSonnim/articles/issues/events{/number}","events_url":"https://api.github.com/repos/MammaSonnim/articles/events","assignees_url":"https://api.github.com/repos/MammaSonnim/articles/assignees{/user}","branches_url":"https://api.github.com/repos/MammaSonnim/articles/branches{/branch}","tags_url":"https://api.github.com/repos/MammaSonnim/articles/tags","blobs_url":"https://api.github.com/repos/MammaSonnim/articles/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MammaSonnim/articles/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MammaSonnim/articles/git/refs{/sha}","trees_url":"https://api.github.com/repos/MammaSonnim/articles/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MammaSonnim/articles/statuses/{sha}","languages_url":"https://api.github.com/repos/MammaSonnim/articles/languages","stargazers_url":"https://api.github.com/repos/MammaSonnim/articles/stargazers","contributors_url":"https://api.github.com/repos/MammaSonnim/articles/contributors","subscribers_url":"https://api.github.com/repos/MammaSonnim/articles/subscribers","subscription_url":"https://api.github.com/repos/MammaSonnim/articles/subscription","commits_url":"https://api.github.com/repos/MammaSonnim/articles/commits{/sha}","git_commits_url":"https://api.github.com/repos/MammaSonnim/articles/git/commits{/sha}","comments_url":"https://api.github.com/repos/MammaSonnim/articles/comments{/number}","issue_comment_url":"https://api.github.com/repos/MammaSonnim/articles/issues/comments{/number}","contents_url":"https://api.github.com/repos/MammaSonnim/articles/contents/{+path}","compare_url":"https://api.github.com/repos/MammaSonnim/articles/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MammaSonnim/articles/merges","archive_url":"https://api.github.com/repos/MammaSonnim/articles/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MammaSonnim/articles/downloads","issues_url":"https://api.github.com/repos/MammaSonnim/articles/issues{/number}","pulls_url":"https://api.github.com/repos/MammaSonnim/articles/pulls{/number}","milestones_url":"https://api.github.com/repos/MammaSonnim/articles/milestones{/number}","notifications_url":"https://api.github.com/repos/MammaSonnim/articles/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MammaSonnim/articles/labels{/name}","releases_url":"https://api.github.com/repos/MammaSonnim/articles/releases{/id}","deployments_url":"https://api.github.com/repos/MammaSonnim/articles/deployments","created_at":"2016-11-10T08:08:14Z","updated_at":"2016-11-10T08:08:15Z","pushed_at":"2016-11-24T11:34:51Z","git_url":"git://github.com/MammaSonnim/articles.git","ssh_url":"git@github.com:MammaSonnim/articles.git","clone_url":"https://github.com/MammaSonnim/articles.git","svn_url":"https://github.com/MammaSonnim/articles","homepage":null,"size":6992,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"basisjs:master","ref":"master","sha":"aea3cc50ecaf629f2d27c72eb6e9da3230a62442","user":{"login":"basisjs","id":3409558,"avatar_url":"https://avatars.githubusercontent.com/u/3409558?v=3","gravatar_id":"","url":"https://api.github.com/users/basisjs","html_url":"https://github.com/basisjs","followers_url":"https://api.github.com/users/basisjs/followers","following_url":"https://api.github.com/users/basisjs/following{/other_user}","gists_url":"https://api.github.com/users/basisjs/gists{/gist_id}","starred_url":"https://api.github.com/users/basisjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basisjs/subscriptions","organizations_url":"https://api.github.com/users/basisjs/orgs","repos_url":"https://api.github.com/users/basisjs/repos","events_url":"https://api.github.com/users/basisjs/events{/privacy}","received_events_url":"https://api.github.com/users/basisjs/received_events","type":"Organization","site_admin":false},"repo":{"id":10441360,"name":"articles","full_name":"basisjs/articles","owner":{"login":"basisjs","id":3409558,"avatar_url":"https://avatars.githubusercontent.com/u/3409558?v=3","gravatar_id":"","url":"https://api.github.com/users/basisjs","html_url":"https://github.com/basisjs","followers_url":"https://api.github.com/users/basisjs/followers","following_url":"https://api.github.com/users/basisjs/following{/other_user}","gists_url":"https://api.github.com/users/basisjs/gists{/gist_id}","starred_url":"https://api.github.com/users/basisjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basisjs/subscriptions","organizations_url":"https://api.github.com/users/basisjs/orgs","repos_url":"https://api.github.com/users/basisjs/repos","events_url":"https://api.github.com/users/basisjs/events{/privacy}","received_events_url":"https://api.github.com/users/basisjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/basisjs/articles","description":"Articles about basis.js","fork":false,"url":"https://api.github.com/repos/basisjs/articles","forks_url":"https://api.github.com/repos/basisjs/articles/forks","keys_url":"https://api.github.com/repos/basisjs/articles/keys{/key_id}","collaborators_url":"https://api.github.com/repos/basisjs/articles/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/basisjs/articles/teams","hooks_url":"https://api.github.com/repos/basisjs/articles/hooks","issue_events_url":"https://api.github.com/repos/basisjs/articles/issues/events{/number}","events_url":"https://api.github.com/repos/basisjs/articles/events","assignees_url":"https://api.github.com/repos/basisjs/articles/assignees{/user}","branches_url":"https://api.github.com/repos/basisjs/articles/branches{/branch}","tags_url":"https://api.github.com/repos/basisjs/articles/tags","blobs_url":"https://api.github.com/repos/basisjs/articles/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/basisjs/articles/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/basisjs/articles/git/refs{/sha}","trees_url":"https://api.github.com/repos/basisjs/articles/git/trees{/sha}","statuses_url":"https://api.github.com/repos/basisjs/articles/statuses/{sha}","languages_url":"https://api.github.com/repos/basisjs/articles/languages","stargazers_url":"https://api.github.com/repos/basisjs/articles/stargazers","contributors_url":"https://api.github.com/repos/basisjs/articles/contributors","subscribers_url":"https://api.github.com/repos/basisjs/articles/subscribers","subscription_url":"https://api.github.com/repos/basisjs/articles/subscription","commits_url":"https://api.github.com/repos/basisjs/articles/commits{/sha}","git_commits_url":"https://api.github.com/repos/basisjs/articles/git/commits{/sha}","comments_url":"https://api.github.com/repos/basisjs/articles/comments{/number}","issue_comment_url":"https://api.github.com/repos/basisjs/articles/issues/comments{/number}","contents_url":"https://api.github.com/repos/basisjs/articles/contents/{+path}","compare_url":"https://api.github.com/repos/basisjs/articles/compare/{base}...{head}","merges_url":"https://api.github.com/repos/basisjs/articles/merges","archive_url":"https://api.github.com/repos/basisjs/articles/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/basisjs/articles/downloads","issues_url":"https://api.github.com/repos/basisjs/articles/issues{/number}","pulls_url":"https://api.github.com/repos/basisjs/articles/pulls{/number}","milestones_url":"https://api.github.com/repos/basisjs/articles/milestones{/number}","notifications_url":"https://api.github.com/repos/basisjs/articles/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/basisjs/articles/labels{/name}","releases_url":"https://api.github.com/repos/basisjs/articles/releases{/id}","deployments_url":"https://api.github.com/repos/basisjs/articles/deployments","created_at":"2013-06-02T19:55:28Z","updated_at":"2016-11-07T21:56:19Z","pushed_at":"2016-11-24T11:34:52Z","git_url":"git://github.com/basisjs/articles.git","ssh_url":"git@github.com:basisjs/articles.git","clone_url":"https://github.com/basisjs/articles.git","svn_url":"https://github.com/basisjs/articles","homepage":null,"size":7040,"stargazers_count":36,"watchers_count":36,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":13,"mirror_url":null,"open_issues_count":3,"forks":13,"open_issues":3,"watchers":36,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/basisjs/articles/pulls/40"},"html":{"href":"https://github.com/basisjs/articles/pull/40"},"issue":{"href":"https://api.github.com/repos/basisjs/articles/issues/40"},"comments":{"href":"https://api.github.com/repos/basisjs/articles/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/basisjs/articles/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/basisjs/articles/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/basisjs/articles/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/basisjs/articles/statuses/c377a603e19c7d7f32dc0946a72b0c22c764756c"}}}}
{"actor":{"display_login":"MammaSonnim"}}