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

Make the attributemap a single instance that lives in the DI and can be appended by apps #32

Closed Alxandr closed 8 years ago

Alxandr commented 9 years ago

Currently, if you encounter an attribute - property pair with different names (like colspan != colSpan) it has to be added to aurelia, and you have to wait for a new release.

Or, you could inject the binding-language, hoping that it's the default one, and use a private API to extend it yourself.

I'm suggesting it should exist as a simple public API used by the binding language instead, so I can do stuff like this in my main:

const attributeMap = di.get(AttributeMap);
attributeMap.register('foo-bar', 'fooBar');
aurelia.start......;

Note, it doesn't have to be exactly like that, it's only a suggestion to the API. The point is to have something simple and extendible, with a public API surface.

jdanyow commented 9 years ago

:+1:

Would be nice if attribute maps could be scoped to a particular node type as well.

https://github.com/aurelia/binding/issues/80#issuecomment-102217602

EisenbergEffect commented 9 years ago

@jdanyow Any thoughts on this? Should we make some improvements for this?

jdanyow commented 9 years ago

I think we need to implement this as well as support for mapping specific node-name/attr-name combinations. Will put this in my queue.

Alxandr commented 9 years ago

@jdanyow I suggest just extending the api to

attributeMap.get(node.tagName, 'attribute-name');

Would allow it to choose to ignore or care about the tag name on it's own.

jdanyow commented 8 years ago

implemented in https://github.com/aurelia/templating-binding/commit/4f3e91198a0102ca82fc791d5b69a77cfff94e43