{"action":"created","issue":{"url":"https://api.github.com/repos/w3c/webcomponents/issues/519","repository_url":"https://api.github.com/repos/w3c/webcomponents","labels_url":"https://api.github.com/repos/w3c/webcomponents/issues/519/labels{/name}","comments_url":"https://api.github.com/repos/w3c/webcomponents/issues/519/comments","events_url":"https://api.github.com/repos/w3c/webcomponents/issues/519/events","html_url":"https://github.com/w3c/webcomponents/issues/519","id":159304785,"number":519,"title":"[idea] Allow HTML Element attributes to accept any type of value, not just strings.","user":{"login":"trusktr","id":297678,"avatar_url":"https://avatars.githubusercontent.com/u/297678?v=3","gravatar_id":"","url":"https://api.github.com/users/trusktr","html_url":"https://github.com/trusktr","followers_url":"https://api.github.com/users/trusktr/followers","following_url":"https://api.github.com/users/trusktr/following{/other_user}","gists_url":"https://api.github.com/users/trusktr/gists{/gist_id}","starred_url":"https://api.github.com/users/trusktr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trusktr/subscriptions","organizations_url":"https://api.github.com/users/trusktr/orgs","repos_url":"https://api.github.com/users/trusktr/repos","events_url":"https://api.github.com/users/trusktr/events{/privacy}","received_events_url":"https://api.github.com/users/trusktr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":20,"created_at":"2016-06-09T00:17:30Z","updated_at":"2016-06-13T23:40:32Z","closed_at":null,"body":"#517 covers two things: \r\n\r\n1. ability to define attributes for custom elements (and optionally specify getters/setters for those attributes)\r\n2. Ability for DOM API to accept anything, not just strings, for attributes.\r\n\r\nI'd like #517 to be about the first idea, and would like to make this issue specifically about the ability for DOM APIs like `setAttribute`/`getAttribute` to be able to accept any JavaScript values besides strings so that we can avoid performance costs from serialization/deserialization. We would be able to pass objects, arrays, numbers, instances of custom classes, etc.\r\n\r\nPlease see #517 for details (maybe I can move those details here...).\r\n\r\nFor example, imagine some error component specialized in displaying errors, who's error attribute can accept an actual instance of an `Error`:\r\n\r\n```js\r\ntry {\r\n    // ...\r\n}\r\ncatch (err) {\r\n    let errorDisplay = document.createElement('error-display')\r\n    errorDisplay.setAttribute('error', err)\r\n    document.querySelector('#error-list').appendChild(errorDisplay)\r\n}\r\n```\r\n\r\nOr, using the setter/getter feature described in #517:\r\n\r\n```js\r\ntry {\r\n    // ...\r\n}\r\ncatch (err) {\r\n    let errorDisplay = document.createElement('error-display')\r\n    errorDisplay.error = err\r\n    document.querySelector('#error-list').appendChild(errorDisplay)\r\n}\r\n```\r\n\r\nI really think making APIs easier to use (f.e. opt-in setters/getters mechanism for attributes on Custom Elements, not requiring serialization/deserialization by allowing attributes to accept values other than strings, etc), is a good goal for Web stack to have!"},"comment":{"url":"https://api.github.com/repos/w3c/webcomponents/issues/comments/225740173","html_url":"https://github.com/w3c/webcomponents/issues/519#issuecomment-225740173","issue_url":"https://api.github.com/repos/w3c/webcomponents/issues/519","id":225740173,"user":{"login":"treshugart","id":136556,"avatar_url":"https://avatars.githubusercontent.com/u/136556?v=3","gravatar_id":"","url":"https://api.github.com/users/treshugart","html_url":"https://github.com/treshugart","followers_url":"https://api.github.com/users/treshugart/followers","following_url":"https://api.github.com/users/treshugart/following{/other_user}","gists_url":"https://api.github.com/users/treshugart/gists{/gist_id}","starred_url":"https://api.github.com/users/treshugart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/treshugart/subscriptions","organizations_url":"https://api.github.com/users/treshugart/orgs","repos_url":"https://api.github.com/users/treshugart/repos","events_url":"https://api.github.com/users/treshugart/events{/privacy}","received_events_url":"https://api.github.com/users/treshugart/received_events","type":"User","site_admin":false},"created_at":"2016-06-13T23:40:32Z","updated_at":"2016-06-13T23:40:32Z","body":"What if attribute methods just proxied the properties?"}}
{"actor":{"display_login":"treshugart"}}