-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure class and id attributes work properly. #4
Comments
@rwjblue, what's the recommended way of accessing these attributes in a tagless component? Passing I noticed the values are exposed via |
It should not be possible to access attribute values in the component JavaScript at all. If your component needs to do something with a value it should be passed as a named argument (e.g. as
This is a private implementation detail of this polyfill, when Ember 3.4+ is used this will not work... |
@rwjblue, thanks for the explanation! |
I know it's not totally related to this issue but I stumbled across this issue when I searched for a way to access the
I'm not 100% sure if this constraint is very beneficial. We have the following problem: We have an <div class="c-select{{if this.disabled " disabled"}}">
<label for="objecttype">{{@label}}</label>
<select id="objecttype" disabled={{this.disabled}} ...attributes>
{{yield}}
</select>
{{#if @hint}}
<div class="hint">{{@hint}}</div>
{{else}}
<div class="spacer"> </div>
{{/if}}
</div> Now the "user" of this component needs to know exactly what attributes are JS specific and which are HTML only. Since <CustomInput
@hint="hint" // okay, hint is no HTML attribute use @
@label="label" // okay, label is no HTML attribute use @
@disabled=this.isSaving // okay, disabled is a HTML attribute but we use it in JS as well so use @
id="id" // okay, id is a HTML attribute do not use @
name="name" // okay, name is a HTML attribute do not use @
class="some-extra-css" // okay, class is a HTML attribute do not use @
/> This didn't seem so nice to us so we decided to try to workaround this problem. Then we thought we could use the Maybe I just think wrong or I overlook something but I'm not sure how to solve this and keep a nice api for the "component user" |
Using the following should set id and class on the rendered element:
The current system adds to attributeBindings, but since
class
andid
are “special” we should add some tests to ensure they work properly.The text was updated successfully, but these errors were encountered: