Skip to content

Instantly share code, notes, and snippets.

@jelhan
Created April 13, 2019 10:09
Show Gist options
  • Save jelhan/74a339b46d1a87421927992e5a073d1f to your computer and use it in GitHub Desktop.
Save jelhan/74a339b46d1a87421927992e5a073d1f to your computer and use it in GitHub Desktop.
component-innerhtml-and-splash-attributes
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<h1>Components using innerHTML and splash attributes at same time</h1>
<p>
Components behave unexpected if using <i>innerHTML</i> and <i>...attributes</i> at the same time. The attributes passed in are applied to the element defined by component (<i>tagName</i>) and are applied to the element <i>...attributes</i> is used on.<br>
If you inspect the HTML rendered by component above you will see that class <i>foo</i> is applied to both the div defined by component and the paragraph splash attributes are used on.
</p>
<MyComponent class="foo">
test
</MyComponent>
<p ...attributes>
{{yield}}
</p>
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-angle-bracket-invocation-polyfill": "1.3.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment