{"action":"created","issue":{"url":"https://api.github.com/repos/aurelia/templating/issues/300","repository_url":"https://api.github.com/repos/aurelia/templating","labels_url":"https://api.github.com/repos/aurelia/templating/issues/300/labels{/name}","comments_url":"https://api.github.com/repos/aurelia/templating/issues/300/comments","events_url":"https://api.github.com/repos/aurelia/templating/issues/300/events","html_url":"https://github.com/aurelia/templating/issues/300","id":142066738,"number":300,"title":"Should bound values of dashed \"attributes\" be assigned to dashed properties or camelCase ","user":{"login":"EisenbergEffect","id":131485,"avatar_url":"https://avatars.githubusercontent.com/u/131485?v=3","gravatar_id":"","url":"https://api.github.com/users/EisenbergEffect","html_url":"https://github.com/EisenbergEffect","followers_url":"https://api.github.com/users/EisenbergEffect/followers","following_url":"https://api.github.com/users/EisenbergEffect/following{/other_user}","gists_url":"https://api.github.com/users/EisenbergEffect/gists{/gist_id}","starred_url":"https://api.github.com/users/EisenbergEffect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EisenbergEffect/subscriptions","organizations_url":"https://api.github.com/users/EisenbergEffect/orgs","repos_url":"https://api.github.com/users/EisenbergEffect/repos","events_url":"https://api.github.com/users/EisenbergEffect/events{/privacy}","received_events_url":"https://api.github.com/users/EisenbergEffect/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-03-19T14:31:57Z","updated_at":"2016-04-10T23:48:29Z","closed_at":null,"body":"@jpray commented on [Sat Mar 19 2016](https://github.com/aurelia/framework/issues/370)\n\nHi!\r\n\r\nI have a bunch of vanilla custom elements that I'm working on using within an Aurelia app.  A standard interface for custom elements are HTML attributes, so I was a bit surprised to see that something like\r\n```\r\n  <my-vanilla-custom-element\r\n    bar=${aValueForBar}\r\n  </my-vanilla-custom-element>\r\n```\r\nwould assign the value of aValueForBar to the bar property and not set the attribute.  But after reading more I came to accept that this was probably done for performance reasons, though I do think it would still be nice to have an option to have it set the attribute without having to declare a custom attribute.  I assume this is technically feasible?  I wouldn't mind taking a stab at implementing it if you all think it makes sense and could provide some direction.  Maybe an alternative syntax to have templating behave this way?\r\n\r\nAlso, during this exercise I noticed that when doing something like this\r\n\r\n```\r\n  <my-vanilla-custom-element\r\n    foo-bar=${aValueForFooBar} \r\n  </my-vanilla-custom-element>\r\n```\r\nthis['foo-bar'] will contain the value.  Here's a [plunker](http://plnkr.co/edit/y3BRrPOelHejTrTJZmXn?p=preview) illustrating this.\r\n\r\nFor my own vanilla custom elements, I set them up so that dashed attributes are automatically bound to camelCase properties, similar to Polymer.\r\n\r\nfrom https://www.polymer-project.org/1.0/docs/devguide/properties.html\r\n> Attribute names with dashes are converted to camelCase property names by capitalizing the character following each dash, then removing the dashes. For example, the attribute first-name maps to firstName.\r\n \r\n Currently it seems there is no easy way for me to set the foo-bar attribute nor the fooBar property of the element.  I can do it by defining customAttributes but I don't want to have to define dozens of customAttributes simply to achieve this behavior. \r\n\r\nThoughts? Thanks!\r\n\n\n"},"comment":{"url":"https://api.github.com/repos/aurelia/templating/issues/comments/208094145","html_url":"https://github.com/aurelia/templating/issues/300#issuecomment-208094145","issue_url":"https://api.github.com/repos/aurelia/templating/issues/300","id":208094145,"user":{"login":"kevmeister68","id":9400554,"avatar_url":"https://avatars.githubusercontent.com/u/9400554?v=3","gravatar_id":"","url":"https://api.github.com/users/kevmeister68","html_url":"https://github.com/kevmeister68","followers_url":"https://api.github.com/users/kevmeister68/followers","following_url":"https://api.github.com/users/kevmeister68/following{/other_user}","gists_url":"https://api.github.com/users/kevmeister68/gists{/gist_id}","starred_url":"https://api.github.com/users/kevmeister68/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevmeister68/subscriptions","organizations_url":"https://api.github.com/users/kevmeister68/orgs","repos_url":"https://api.github.com/users/kevmeister68/repos","events_url":"https://api.github.com/users/kevmeister68/events{/privacy}","received_events_url":"https://api.github.com/users/kevmeister68/received_events","type":"User","site_admin":false},"created_at":"2016-04-10T23:48:29Z","updated_at":"2016-04-10T23:48:29Z","body":"I think the way it works *now* is quite sensible. I am talking about the default behaviour.\r\n\r\nYes, changing makes things more consistent from the perspective of Aurelia, but it actually makes things less consistent from the perspective of someone who is dipping their toe into the waters of Aurelia and trying to retrofit small parts of Aurelia into existing HTML. In other words, a user who originally had a standard custom element with a hyphenated attribute name will now find that if they apply an Aurelia binding expression to that attribute, their code may no longer work as expected.\r\n\r\nSo if you do provide a way to do this, I think the current way should remain as the default, and any \"special behaviour\" needs to be specifically requested by the developer. Should the behaviour be defined at the .bind level, at the custom element usage level eg. <my-custom-element au-bind-behaviour=\"camelCase\">, at the custom element definition level, or some other way? The obvious first step would be to tell Aurelia about specific custom elements and define what their binding conventions should be, similar to how custom-elements are advised to the DOM through document.registerElement.\r\n"}}