-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Duplicate tbody in ngFor #5967
Comments
Actually, the issue doesn't depend on ngFor at all, the same thing happens with a template like this: <tbody myTableRow></tbody> The problem is caused by the fact that the template parser's required parent logic applies to the template's root elements too: but the parent element of the template's root element is unkown at the time when the template is compiled, it will only be revealed when the component is inserted into the page. If I change angular's html parser to skip the required parent logic for the root element(s), then everything works fine. In html_parser.ts if (tagDef.requireExtraParent(isPresent(parentEl) ? parentEl.name : null)) { should be: if (isPresent(parentEl) && tagDef.requireExtraParent(parentEl.name)) { |
@ggmod what is the version of Angular2 that you are using? Could you please provide a reproduce scenario with plunker (or similar on-line tool)? |
Both the plunker and the version number are there in the original post, but here it is again: |
Yes, I see, this is a bug. Thnx for reporting. |
hi guys! any idea when this would be fixed? I am using 2.0.0-beta.3 and the issue is still there :) |
+1 Need a fix for this bug |
+1, also need a fix for this bug (using beta.7) |
Maybe someone is willing to try to fix it? |
@PascalPrecht, already @ggmod mentioned a fix above. But it's not a pull request. I am currently using his fix with angular beta.7 |
I seriously need the fix for this bug. +1 I had to make a workaround with using a div with display: table-row to avoid a tbody getting generated. |
+1 |
Is this going to make it into a release soon? |
+1 I need also a fix for this. |
+1 this needs to be fixed Also, when trying to create a component using |
I just stumpled across the same issue (using beta.14) The issue acutally seems to be that the template starts with a |
+1 I would like this bug fixed, as workaround I replaced all table elements with divs and created css classes (such as .table, .thead, .tr, .td, .th) but thats really ugly non-semantic solution. |
I guess that's a browser feature. Angular probably creates |
@zoechi i don't think that's the issue if you execute var df = new DocumentFragment();
df.appendChild(document.createElement('tr'));
document.querySelector('body').appendChild(df); you get exactly the dom you would expect: <body>
<tr></tr>
</body> not very useful or even valid but still exactly what you defined |
Any update on this one? It's a P2 with a fix attached to it -- but this bug still made it into the release candidate. |
- Also still experiencing socket cleanup issues due to angular/angular#8458 - Tables were changed with cards in previous commit due to angular/angular#5967
+1 Also just ran into this with rc.1. |
It seems like you're doing it wrong? here's the way I write this. I don't see any reference to your syntax in the docs at https://angular.io/docs/ts/latest/guide/template-syntax.html
EDIT: this is probably what you really want:
|
your
and your myTableRow component will be re-rendered, including it's host element, which is tbody the way you've constructed it. Maybe the syntax was different earlier, but i think this is how it's supposed to work? |
@fringd this should lead to
but the result is
|
oh weird. the example at the top is a confusing example then. why would anybody want multiple tbody elements? |
@pkozlowski-opensource Is there anything we can do to speed this up? There’s already a proposed fix above. Would that be an acceptable fix? Do you need a pull request including that change? Can we please get this fixed soon? |
+1 on this. FYI, in rc1 this is fixed by: |
I am still facing the same issue even after applying the below.Its generate 2 duplicate items template is angular version :2.0.0-beta.17 |
fix is coming... |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
If I write something like this:
that uses the following component:
then it produces invalid HTML, there will be two nested tbody tags, like this:
(In the real application I use this to group together multiple tr tags in a tbody, and the table has many tbody tags after each other)
I get all kinds of malformed tables because of this, and it also breaks the usual
table > tbody > td
CSS rules, and is actually invalid HTML.This worked fine with alpha.46, but has been broken since alpha.47.
Demo here: http://plnkr.co/edit/myYJZf6ZZj1ofhIcNj7E?p=preview
The text was updated successfully, but these errors were encountered: