aurelia / templating-binding

An implementation of the templating engine's Binding Language abstraction which uses a pluggable command syntax.
MIT License
32 stars 26 forks source link

custom attribute mapping to support polymer camelCased attributes #21

Closed jdanyow closed 9 years ago

jdanyow commented 9 years ago

So we don't lose track of this...

gitter discussion

current work-around:

import {TemplatingBindingLanguage} from 'aurelia-framework'; // or from 'aurelia-templating-binding'

.. resolve TemplatingBindingLanguage from container...

function mapPolymerElementAttributes(elementName){
    Polymer.elements
        .find( ele => ele.name === elementName )
        .getAttribute('attributes').split(' ')
        .forEach( attr => {
            if (attr.toLowerCase() !== attr)
                bindingLang.attributeMap[attr.toLowerCase()] = attr;
        });
}

further work required to avoid stomping on built-in attribute maps and to support scenario where polymer element 1 has a fooBar attribute and polymer element 2 has a fooBAR attribute.

olanod commented 9 years ago

This should work in the meantime, but in the not so far future when next Polymer version launches we can use the convention of dashed attributes to camel case. They are putting that functionality back for the 0.8 release.