Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Proposal] Re-name the nested helper (subexpression) to "html-attributes" #2

Closed
crodriguez1a opened this issue Aug 3, 2017 · 7 comments

Comments

@crodriguez1a
Copy link

crodriguez1a commented Aug 3, 2017

When the concept was first proposed, @mmun suggested the following:

{{my-component (html-attributes aria-labelledby="label-name")}}

I wonder if there is consensus to circle back to that naming? It think html-attributes more clearly solidifies that the helper is intended to apply native HTML attributes to a component. Whereas, just using attributes could potentially confuse new adopters of Ember. I'm anticipating new adopters might try something like:

{{my-component (attributes aria-labelledby="label-name"  my-special-thing="my special value")}}

{{! intending to define a property, which should have been written as follows: }}

{{my-component (html-attributes aria-labelledby="label-name") mySpecialThing="my special value"}}

I know it seems odd, but I've seen other frameworks that tend to conflate properties and attributes.

@mmun
Copy link
Owner

mmun commented Aug 3, 2017

{{my-component mySpecialThing="my special value" (html-attributes aria-labelledby="label-name")}}

Small nit, but your second example is not syntactically valid. Positional arguments must come before named arguments.

@crodriguez1a
Copy link
Author

@mmun Ah! Fixed.

@rwjblue
Copy link
Collaborator

rwjblue commented Aug 3, 2017

I'm not opposed to renaming though I don't have an issue with the current name...

@buschtoens
Copy link
Contributor

buschtoens commented Aug 3, 2017

I'm probably stating the obvious, but the advantage of attributes over html-attributes is that it's five characters shorter and thus a bit faster to type and easier to squeeze in a single line. Having said that, the advantage of html-attributes is that it's more explicit and can't possibly be confused with "regular data attributes".

I and likely many others (hopefully?) tend to write component invocations in multiple lines anyways.

{{my-component posArg1 posArg2
  (html-attributes
    role="button"
    aria-labelledby="label-name"
    title=title
  )
  showStuff=true
  levelOfFanciness="over-9000"
  doYouLikeLlamas="absolutely"
  dogOrCatPerson="dog"
}}

@mmun
Copy link
Owner

mmun commented Sep 11, 2017

Let's go with html-attributes. I'll leave support for attributes around for now, but update the README. We can hash out the winner in a future RFC but I'm leaning towards html-attributes.

@rwjblue
Copy link
Collaborator

rwjblue commented Oct 5, 2017

Seems good to me.

Any takers on doing the PR?

@mmun
Copy link
Owner

mmun commented Oct 5, 2017

Closed by #5

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants