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

Add implicit ...attributes to wrapped layouts. #823

Merged
merged 2 commits into from
May 31, 2018

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented May 31, 2018

This implements the implicit ...attributes support for wrapped layouts (which is what Ember.Component uses) as specified in the Angle Bracket Invocation RFC:

Classic components (Ember.Component) will implicitly have an ...attributes added to the end of the wrapper element (if tagName is not an empty string), after any attributes added by the component itself (using attributeBindings, classNames etc). This means that attributes provided by the caller will override (replace) those added by the component (except for class, which is merged).

TODO:

  • add tests confirming merging behaviors (invocation attributes clobber, except class which merges)


constructor(
private compiler: Compiler<OpcodeBuilder<Locator>>,
private layout: LayoutWithContext<Locator>
) {
let { block } = layout;

let symbols = block.symbols.slice();
this.symbolTable = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this assignment to L45 just so it's easier to understand that you are going to mutate symbols and place it in the symbolTable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, makes sense. Will update.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Thanks for reviewing!

@rwjblue rwjblue force-pushed the splattributes-wrapped-element branch from 82fed14 to ad5ead6 Compare May 31, 2018 19:06
@chadhietala chadhietala merged commit ca1e639 into glimmerjs:master May 31, 2018
@rwjblue rwjblue deleted the splattributes-wrapped-element branch May 31, 2018 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants