Skip to content
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

replace all instances of attribute based flex layout and replace with class based ones #507

Closed
3 tasks done
miguelcobain opened this issue Oct 3, 2016 · 7 comments
Closed
3 tasks done

Comments

@miguelcobain
Copy link
Owner

miguelcobain commented Oct 3, 2016

Previously we used Angular Material's attribute based flex layout like:

<div layout="row">
  <div flex>First item in row</div>
  <div flex="20">Second item in row</div>
</div>

However, sometimes we need these attributes in components, so we created a FlexMixin that has those attributeBindings, e.g {{paper-component flex="20"}}. However, the current scenario is suboptimal:

  • There are performance penalties with generic css attribute-based selectors, especially in IE
  • Always using FlexMixin in every component is not very handy, especially because we cant use an attribute binding named layout. That property name is already taken in Ember components.

Angular Material converts attributes to classes under the hood with attribute directives. We think the classes AM uses under the hood make a perfect public api. Ember components and normal elements support class attribute by default.

So, the above example converts to:

<div class="layout-row">
  <div class="flex">First item in row</div>
  <div class="flex-20">Second item in row</div>
</div>

TODO:

@chriskrycho
Copy link

👋 I might take a stab at this this week.

@topaxi
Copy link
Contributor

topaxi commented Oct 14, 2016

+1

I'm currently excluding the attribute css file by hand (by completely copying the ember-paper.scss except that one import statement) because it makes the output css file huge!

@chriskrycho
Copy link

chriskrycho commented Oct 14, 2016 via email

@jamesdixon
Copy link

I noticed in the Angular docs that it says:

Developers should continue to use Layout directives in the HTML markup as the classes may change between releases.

Thoughts?

@joukevandermaas
Copy link
Contributor

@jamesdixon angular has some capabilities that ember does not. Those directives are translated to classes at runtime (or compile time?). In ember they would remain in the DOM, with performance and flexibility concerns.

I think the general conclusion was that classes are a better fit for ember.

@jamesdixon
Copy link

Fair enough! Just wanted to mention it. Thanks, @joukevandermaas!

@miguelcobain
Copy link
Owner Author

Fixed (see #507 (comment) for details)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants