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

Ensure dynamic component invocations follow splattribute rules. #847

Merged

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Sep 5, 2018

When the DynamicComponent opcode was initial introduce, it did not properly replicate the SetComponentAttrs toggling system that Ops.Component has. This has the unfortunate result of making dynamic component invocations not follow the established rules for splattributes (invocation "wins" for all attributes other than class and class is merged). The implementation here for attrs block created here, is directly taken from the Ops.Component opcode just below...

In this context DynamicComponent is specifically referring to angle bracket invocation with either a named argument or path.


Once merged, this needs to be backported into the version of glimmer-vm in use by Ember 3.4.x to fix the bug reported by @cibernox in emberjs/ember.js#16933 and rwjblue/sparkles-component#7.

})
'invoking curried component with attributes via angle brackets (invocation attributes clobber)'() {
this.registerHelper('hash', (_positional, named) => named);
this.registerComponent('Glimmer', 'Foo', '<p data-foo="default"...attributes>hello world!</p>');

Choose a reason for hiding this comment

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

nitpicking: space between "default" and ...attributes

When the `DynamicComponent` opcode was initial introduce, it did not
properly replicate the `SetComponentAttrs` toggling system that
`Ops.Component` has. This has the unfortunate result of making dynamic
component invocations not follow the established rules for
splattributes (invocation "wins" for all attributes other than `class`
and `class` is merged).

In this context `DynamicComponent` is specifically referring to angle
bracket invocation with either a named argument or path.
@rwjblue rwjblue force-pushed the fix-dynamic-component-splattributes branch from f370f2d to e1334ae Compare September 5, 2018 20:27
@rwjblue rwjblue merged commit 9c09fcc into glimmerjs:master Sep 5, 2018
@rwjblue rwjblue deleted the fix-dynamic-component-splattributes branch September 5, 2018 20:58
@rwjblue rwjblue added the bug label Sep 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants