[Glimmer 2] Dasherize someClass to some-class#13401
Conversation
d270b34 to
70e8fe6
Compare
There was a problem hiding this comment.
Wouldn't it be better to use className as it is when explicitly passed? (Ideally to use dasherized attribute name by default for helpers as well, but feels like it is not possible?)
There was a problem hiding this comment.
The behavior today in Ember is if {{foo-bar class=fooBar}} is executed and fooBar evaluates to true we have to reflect on the binding e.g. fooBar and turn the binding name to foo-bar.
There was a problem hiding this comment.
Yeah, I meant that for case class=fooBar it should transform into foo-bar, but in case (-class fooBar "fooBar"), when class passed explicitly by consumer, it should stay fooBar (to solve this you could pass dasherized version from the component and do not dasherize in the helper)
There was a problem hiding this comment.
the last arg is the name of the ref passed in, the ref is the className unless it is a boolean.
There was a problem hiding this comment.
another way to think of it is the last arg is metadata, essential reflection of the path that was bound. the first argument is the className binding, this is an internal helper refined from the class={{boundProp}} to add this additional metadata to handle the case of the boundProp not being a string but a boolean
70e8fe6 to
19f26ab
Compare
|
This will supersede #13338 |
There was a problem hiding this comment.
this should be propName since it isn't actually the class name at this point
This will dasherize `someClass` to `some-class` when a binging is set on a component invocation for the class attribute.
19f26ab to
291af66
Compare
| return dasherize(propName.value()); | ||
| } | ||
|
|
||
| if (value === false) { |
There was a problem hiding this comment.
Once glimmerjs/glimmer-vm#150 lands this can go away.
This will dasherize
someClasstosome-classwhen a binding is set ona component invocation for the class attribute.