{"action":"created","issue":{"url":"https://api.github.com/repos/riot/riot/issues/1783","repository_url":"https://api.github.com/repos/riot/riot","labels_url":"https://api.github.com/repos/riot/riot/issues/1783/labels{/name}","comments_url":"https://api.github.com/repos/riot/riot/issues/1783/comments","events_url":"https://api.github.com/repos/riot/riot/issues/1783/events","html_url":"https://github.com/riot/riot/issues/1783","id":153971425,"number":1783,"title":"Confusing tag instance properties: which are supposed to be html nodes, which tag instances?","user":{"login":"juodumas","id":5197018,"avatar_url":"https://avatars.githubusercontent.com/u/5197018?v=3","gravatar_id":"","url":"https://api.github.com/users/juodumas","html_url":"https://github.com/juodumas","followers_url":"https://api.github.com/users/juodumas/followers","following_url":"https://api.github.com/users/juodumas/following{/other_user}","gists_url":"https://api.github.com/users/juodumas/gists{/gist_id}","starred_url":"https://api.github.com/users/juodumas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juodumas/subscriptions","organizations_url":"https://api.github.com/users/juodumas/orgs","repos_url":"https://api.github.com/users/juodumas/repos","events_url":"https://api.github.com/users/juodumas/events{/privacy}","received_events_url":"https://api.github.com/users/juodumas/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/riot/riot/labels/discussion","name":"discussion","color":"ff44aa"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":19,"created_at":"2016-05-10T10:16:35Z","updated_at":"2016-08-10T03:51:15Z","closed_at":null,"body":"Tag instances are populated with these properties:\r\n* this.root - Node\r\n* this.parent - Tag\r\n* this.tags - Object with custom tag names as keys and Array of Tag or Tag as values\r\n* this[value-of-name-attr] - Node in riot2, Node or Tag (for custom elements) in riot3\r\n* this.tags[value-of-name-attr] - Tag for custom elements in riot2, undefined in riot3\r\n\r\nhttp://plnkr.co/edit/p1I2rQiD4MpUofd9PC18?p=preview\r\n\r\nI find this confusing. Maybe riot3 could have better defined and documented apis for accessing child tag instances and element nodes? While I am not sure what to propose, I think that exposing both (named nodes, tags and all child tags) is very useful when working with custom tags, but it would be nice to have a more intuitive api. Btw., riot3 behavior feels logical after thinking about it, but I think it will be very confusing for newcomers.\r\n\r\n  - [ ] Question\r\n  - [ ] Bug\r\n  - [x] Discussion\r\n  - [ ] Feature request\r\n  - [ ] Tip\r\n  - [ ] Enhancement\r\n  - [ ] Performance\r\n"},"comment":{"url":"https://api.github.com/repos/riot/riot/issues/comments/238759039","html_url":"https://github.com/riot/riot/issues/1783#issuecomment-238759039","issue_url":"https://api.github.com/repos/riot/riot/issues/1783","id":238759039,"user":{"login":"cognitom","id":16032,"avatar_url":"https://avatars.githubusercontent.com/u/16032?v=3","gravatar_id":"","url":"https://api.github.com/users/cognitom","html_url":"https://github.com/cognitom","followers_url":"https://api.github.com/users/cognitom/followers","following_url":"https://api.github.com/users/cognitom/following{/other_user}","gists_url":"https://api.github.com/users/cognitom/gists{/gist_id}","starred_url":"https://api.github.com/users/cognitom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cognitom/subscriptions","organizations_url":"https://api.github.com/users/cognitom/orgs","repos_url":"https://api.github.com/users/cognitom/repos","events_url":"https://api.github.com/users/cognitom/events{/privacy}","received_events_url":"https://api.github.com/users/cognitom/received_events","type":"User","site_admin":false},"created_at":"2016-08-10T03:51:15Z","updated_at":"2016-08-10T03:51:15Z","body":"Is it a possible option to drop `tags` and `refs` at all? We can handle them by `querySelector` like @aMarCruz [said](#issuecomment-218900249).\r\nOr we could easily wrap `querySelector` like this:\r\n\r\n```html\r\n<my-tag>\r\n  <input class=\"first\" value=\"a\">\r\n  <input class=\"first\" value=\"b\">\r\n  <input-special class=\"second\" value=\"x\" />\r\n  <p>{ $('.first').value }</p>\r\n  <script>\r\n    this.querySelector('.first').value // a\r\n    this.querySelectorAll('.first')[1].value // b\r\n\r\n    this.$('.first') // DOM\r\n    this.$('.first', true)// undefined\r\n    this.$('.second') // DOM\r\n    this.$('.second', true) // Tag\r\n  </script>\r\n</my-tag>\r\n```\r\n\r\n- `$`: alias to `querySelector`\r\n- `$$`: alias to `querySelectorAll`\r\n- `querySelector(selector, true)`: gets a Tag instance instead of DOM\r\n- the references could be cached while `update` process\r\n- we might need this conversion? `$('input-special')` --> `$('input-special'),$([data-is='input-special'])`"}}
{"actor":{"display_login":"cognitom"}}