Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix($compile): support templates with thead and tfoot root elements #6290

Closed
wants to merge 1 commit into from

Conversation

lgalfaso
Copy link
Contributor

If the first element in a template is a <thead> or a <tfoot>, then use the existing logic to handle table elements compilation.

Closes #6289

@mary-poppins
Copy link

Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.

  • Uses the issue template (#6290)

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

directive('replaceWithThead', valueFn({
replace: true,
template: '<thead><tr><td>TD</td></tr></thead>'
}));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's another section which runs essentially the same tests with asynchronous (templateUrl) directives, just for completeness you could add those too

@lgalfaso
Copy link
Contributor Author

@caitp Thanks for pointing this out. Updated the PR with these new tests

@lgalfaso lgalfaso added cla: yes and removed cla: no labels Feb 19, 2014
@caitp caitp added this to the 1.2.14 milestone Feb 21, 2014
@caitp caitp self-assigned this Feb 21, 2014
leaf = /(td|th)/.test(type) && table.find('tr');
if (tbody.length && type !== 'tbody') {
leaf = /(td|th)$/.test(type) && table.find('tr');
if (tbody.length && !/(thead|tbody|tfoot)/.test(type)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I don't totally understand the logic the logic here. If we have a tbody, and we aren't a tbody element, then we set the wrapping element to tbody. But tfoot and thead should always be outside of the tbody, no? So if it's a thead or tfoot, it seems like we'd be missing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@caitp I think you are right, will post a simplified patch

If the first element in a template is a <thead> or a <tfoot>, then
use the existing logic to handle table elements compilation.

Closes angular#6289
@btford
Copy link
Contributor

btford commented Feb 28, 2014

@caitp this seems good to me. Can we merge this?

@caitp
Copy link
Contributor

caitp commented Feb 28, 2014

@btford yeah, do the triage crew want to do that? I think we want to get this in for 1.2.14 --- otherwise I'll do it

@ashleygwilliams
Copy link

i could merge it... @btford @caitp

@caitp
Copy link
Contributor

caitp commented Feb 28, 2014

Go for it @ashleygwilliams

@IgorMinar IgorMinar modified the milestones: 1.3.0-beta.1, 1.2.14 Mar 1, 2014
@btford btford assigned btford and unassigned caitp Mar 4, 2014
@btford
Copy link
Contributor

btford commented Mar 4, 2014

I'll do it since @ashleygwilliams is p busy for a while.

@btford
Copy link
Contributor

btford commented Mar 7, 2014

Landed as 53ec5e1. Thanks!

@btford btford closed this Mar 7, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

$compile throws an error when template has 'tfoot' as root element
6 participants