minutebase / ember-dynamic-component

Ember addon to render a dynamic component
MIT License
40 stars 4 forks source link

The tagName attribute results in an extra wrapping element #5

Open lolmaus opened 9 years ago

lolmaus commented 9 years ago

dynamic-component seems to be able to render required components without wrapping them in an extra element:

<div id="ember515" class="ember-view"> <!-- this is the component -->
  <p>Component content</p>
</div>

But when i pass tagName to dynamic component, e. g.

{{dynamic-component
  type=model.type
  tagName="section" }}

...then an extra wrapper appears:

<section class="ember-view"> <!-- this is extra wrapper -->
  <section id="ember515" class="ember-view"> <!-- this is the component -->
    <p>Component content</p>
  </section>
</section>
rlivsey commented 9 years ago

Thanks, I'll take a look asap.

The outer wrapper is the container view, which is a virtual metamorph by default. Adding the tagName is being passed to this in addition to the inner component and makes it show up in the DOM.

If you can upgrade to Ember canary then the new {{component}} helper there should also fix this.