-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 documentation for tagName: '' option on view. #4790
Conversation
I found that specifying tagName: '' on a view will not wrap the generated html in a 'div'. Since I've had to do this a couple of times and there was no documentation about this, thought I'd add it.
I believe that the appropriate way to do this is inherit from |
I'll give this a whirl. Seems kinda hacky. I found that if I specified tagName to '', then it had side effects - the view contents were duplicated elsewhere as I moved to other views. I'm going to try this to see what happens, but I've worked out how to change my (semantic-ui) layout to solve the problem I was having. |
Yep, that solved the side-effects. Thanks. |
@rjackson Thanks for that. Do you want me to update the PR by documenting your comment somewhere? |
@hrishikeshs - I am unsure. @tomdale - Do you have a problem with documenting usage of |
The interesting this here, is why In my case, it was because I had 2 templates, that had this HTML structure:
But if I created a
And my layout broke. I'm now reworking my layout to make this not a I'm wondering why a View-less template doesn't get wrapped in a On 3 May 2014 12:55, Robert Jackson [email protected] wrote:
|
Every view instance is wrapped in a tag so that Ember can find the view in the DOM quickly, by default that tag is a A template is rendered by a view, so it definitely is wrapped the same way. Lets assume you have a Please inspect the DOM (and the resolver logging to show what views are looked up) in: http://emberjs.jsbin.com/meyit/1/edit |
Right-o. I get it now. I'd been inspecting the DOM but didn't realise that So, essentially, inheriting from _MetamorphView makes the View-backed This seems like a valid scenario to me, even though _MetamorphView is On 3 May 2014 13:46, Robert Jackson [email protected] wrote:
|
Just to be clear, there are no non-view backed templates. All templates are rendered by views. The difference here is that auto-generated views are |
Perfect, thanks. By non-View-backed, I mean virtual. Maybe setting a virtual: true property on the View, would be nicer than On 3 May 2014 13:54, Robert Jackson [email protected] wrote:
|
@rjackson in the metal-views branch, you can set tagName to '' and isVirtual without side-effects and _MetamorphView is going away. |
Closing. |
@trek Is there an official solution for this? |
@ofersadgat You can set tagName to '' on any component. |
Any update on this? I am setting tagName="" in my component. But I cannot access the DOM by this.$(). The default tagName (div) is ruining my template style. Is there any solution for this? |
@sourvb There is not any work at the moment on supporting |
This seems like the same as #12500 |
What if I want to use |
example of use case on a component. (ember 2.0 with modern ES6 js)
|
I found that specifying tagName: '' on a view will not wrap the generated html in a 'div'. Since I've had to do this a couple of times and there was no documentation about this, thought I'd add it.