knockout.punches
knockout.punches copied to clipboard
Attribute binding only works with all lowercase binding names
I'm not entirely sure why this line is here https://github.com/mbest/knockout.punches/blob/70ed98d292bb33324aee4986b495c57326d084b6/src/interpolationMarkup.js#L146
but it means that any bindings that have names like this: someBinding
won't work. A couple built in bindings happen to work, such as textInput
, because they are actually aliased to have lower case versions as well. Obviously, a work around is to simply alias any binding that doesn't already have a lower case alias, but I'm not certain why that's necessary. Was this intentional?
Actually, the browser is supposed to lowercase the attributes. So this code just doubly ensures they are lowercase. The general method of converting camel-cased JavaScript to attributes is to add hyphens. Thus someBinding
would become some-binding
.
Thus
someBinding
would becomesome-binding
.
Agreed, that would be the best solution. Right now however, that doesn't work. Would it be reasonable to simply change kebab case to camel case where the lower case version isn't found? e.g., check for a binding named some-binding
like it already does, if that fails, check for a binding named someBinding
.