Martin Malinda
Martin Malinda

Reputation: 1608

Ember - how to make component an empty tag?

tagName: 'img' produces `<img></img>`.

Is there a way to prevent this? I know I could just create a div and put the img inside, but creating the img right away is more convenient for me and I dont need to create any template for the component. Thanks for any input.

Upvotes: 1

Views: 578

Answers (1)

Oren Hizkiya
Oren Hizkiya

Reputation: 4434

I found this issue which indicates that the ember core team is aware of the behavior for self closing tags but probably will not change this behavior before Ember 2.0.

See the quote by @trek in the issue I've linked to:

The documentation is accurate. This is just a bug that hopefully we can address in 2.0. I'm closing this particular issue since it was re: docs. I know @mmun and @mixonic are aware of this general problem.

I wouldn't worry too much. I'll quote @mixonic from the same issue:

This is correct, a view that is based on a self-closing DOM node cannot by definition contain more DOM

So it doesn't seem that anything will be accidentially inserted between the opening and closing tags.

Upvotes: 3

Related Questions