{"action":"created","issue":{"url":"https://api.github.com/repos/WICG/aom/issues/78","repository_url":"https://api.github.com/repos/WICG/aom","labels_url":"https://api.github.com/repos/WICG/aom/issues/78/labels{/name}","comments_url":"https://api.github.com/repos/WICG/aom/issues/78/comments","events_url":"https://api.github.com/repos/WICG/aom/issues/78/events","html_url":"https://github.com/WICG/aom/issues/78","id":238700625,"number":78,"title":"Best interface for relation list properties like labeledBy, controls, ...","user":{"login":"minorninth","id":5933702,"avatar_url":"https://avatars3.githubusercontent.com/u/5933702?v=4","gravatar_id":"","url":"https://api.github.com/users/minorninth","html_url":"https://github.com/minorninth","followers_url":"https://api.github.com/users/minorninth/followers","following_url":"https://api.github.com/users/minorninth/following{/other_user}","gists_url":"https://api.github.com/users/minorninth/gists{/gist_id}","starred_url":"https://api.github.com/users/minorninth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minorninth/subscriptions","organizations_url":"https://api.github.com/users/minorninth/orgs","repos_url":"https://api.github.com/users/minorninth/repos","events_url":"https://api.github.com/users/minorninth/events{/privacy}","received_events_url":"https://api.github.com/users/minorninth/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-06-26T23:49:59Z","updated_at":"2017-07-25T05:42:57Z","closed_at":null,"body":"We need to figure out the best way that AOM properties can express a relationship between the current node and multiple other nodes, for properties like labeledBy, describedBy, controls, owns, ...\r\n\r\nFor example, in ARIA you can specify `aria-labeledby=\"foo bar baz\"` where foo, bar, and baz are the ids of 3 other elements.\r\n\r\nOption 1 is how we specced it now - the setter takes any list-like object and makes a copy, the getter returns a list-like object that's a copy. However, WebIDL doesn't have any way to express that currently\r\n\r\nSpec:\r\n\r\n```idl\r\nattribute iterable<AccessibleNode> labeledBy;\r\n```\r\n\r\nUsage:\r\n\r\n```js\r\nconsole.log(element.accessibleNode.labeledBy.length);\r\nconsole.log(element.accessibleNode.labeledBy[0]);\r\nelement.accessibleNode.labeledBy = [label1, label2];\r\n```\r\n\r\nOption 2 is some type like AccessibleNodeList, but with the type mostly hidden from the developer.\r\n\r\n```idl\r\ninterface AccessibleNodeList {\r\n  unsigned length;\r\n  ...\r\n}\r\n\r\nreadonly attribute AccessibleNodeList labeledBy;\r\n```\r\n\r\nUsage:\r\n\r\n```js\r\nconsole.log(element.accessibleNode.labeledBy.length);\r\nconsole.log(element.accessibleNode.labeledBy[0]);\r\nelement.accessibleNode.labeledBy.add(label1);\r\nelement.accessibleNode.labeledBy.length = 0;\r\n```\r\n\r\nOne weirdness is that just accessing element.accessibleNode.labeledBy creates an empty AccessibleNodeList, which results in shadowing aria-labeledby, even though i didn't set it to anything.\r\n\r\nOr to put it another way, for any other property, I can null it and now the AccessibleNode property no longer shadows the ARIA attribute. But I wouldn't be able to do that here.\r\n\r\nOption 3 is that AccessibleNodeList has a constructor.\r\n\r\nSpec:\r\n```idl\r\nattribute AccessibleNodeList labeledBy;\r\n```\r\n\r\nUsage:\r\n```js\r\nconsole.log(element.accessibleNode.labeledBy); // Might be null\r\nconsole.log(element.accessibleNode.labeledBy[0]);\r\nconsole.log(element.accessibleNode.labeledBy.length);\r\nelement.accessibleNode.labeledBy = new AccessibleNodeList([label1, label2]);\r\n```\r\n\r\nThat has probably the fewest corner cases but seems more verbose and cumbersome than i was hoping.\r\n"},"comment":{"url":"https://api.github.com/repos/WICG/aom/issues/comments/317635355","html_url":"https://github.com/WICG/aom/issues/78#issuecomment-317635355","issue_url":"https://api.github.com/repos/WICG/aom/issues/78","id":317635355,"user":{"login":"robdodson","id":1066253,"avatar_url":"https://avatars0.githubusercontent.com/u/1066253?v=4","gravatar_id":"","url":"https://api.github.com/users/robdodson","html_url":"https://github.com/robdodson","followers_url":"https://api.github.com/users/robdodson/followers","following_url":"https://api.github.com/users/robdodson/following{/other_user}","gists_url":"https://api.github.com/users/robdodson/gists{/gist_id}","starred_url":"https://api.github.com/users/robdodson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robdodson/subscriptions","organizations_url":"https://api.github.com/users/robdodson/orgs","repos_url":"https://api.github.com/users/robdodson/repos","events_url":"https://api.github.com/users/robdodson/events{/privacy}","received_events_url":"https://api.github.com/users/robdodson/received_events","type":"User","site_admin":false},"created_at":"2017-07-25T05:42:57Z","updated_at":"2017-07-25T05:42:57Z","body":"just curious, how does `classList` work under the hood? It seems kinda similar to what we're talking about. For example:\r\n\r\n```html\r\n<div class=\"foo bar\">\r\n// div.classList = ['foo', 'bar', value: 'foo bar']\r\n```\r\n\r\nAlso, having thought about it, option 3 doesn't bother me. Especially if it means a clear path forward."}}
{"actor":{"display_login":"robdodson"}}