Skip to content
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

Bug: <template> as child of <ul> is not allowed #138

Closed
zakjan opened this issue Nov 29, 2016 · 10 comments
Closed

Bug: <template> as child of <ul> is not allowed #138

zakjan opened this issue Nov 29, 2016 · 10 comments
Assignees
Labels
Milestone

Comments

@zakjan
Copy link

zakjan commented Nov 29, 2016

template tag (or maybe even any containerless element) should be allowed

@MeirionHughes
Copy link
Contributor

template is not a valid child of lists and tables. Browsers will ignore (remove) non-valid child markup when its parsed and its parsed before aurelia gets a hold of it (so you can't even have containerless).

@zakjan
Copy link
Author

zakjan commented Nov 29, 2016

Oh :( ok

@MeirionHughes
Copy link
Contributor

Its a pain; some guys in Aurelia team hit this too. The odd thing is spec says you should be able to have script/template items, but in reality the browsers are inconsistent.

Chrome will let you have template and its contents, but the contents will be a document fragment. Firefox seems to add a template element but with no contents.

If you want to disable the warning, you can change the config for the valid child rule, or disable it;

I may need to revisit this later if the situation changes.

@zakjan
Copy link
Author

zakjan commented Nov 29, 2016

Thanks for explanation. I try to use ifs and repeats only on template tag, it looks cleaner then mixing into html, this is the only case where I can't do it.

If you want to disable the warning, you can change the config for the valid child rule, or disable it;

Rather not, better be consistent with all modern browsers.

@MeirionHughes
Copy link
Contributor

https://gist.run/?id=33b8032f1c3236ed54cd80a5006c660e

As a sanity check; defo not working for me, even in chrome. :D

@zakjan
Copy link
Author

zakjan commented Nov 29, 2016

But if you add if.bind="true", it works :D Chrome

@MeirionHughes
Copy link
Contributor

MeirionHughes commented Nov 29, 2016

Works in firefox too... how odd.

@zakjan
Copy link
Author

zakjan commented Nov 29, 2016

Looks like template without any arguments is left unprocessed, while template with if.bind or repeat.for is processed correctly by Aurelia as containerless element.

@MeirionHughes MeirionHughes self-assigned this Nov 29, 2016
@MeirionHughes MeirionHughes added this to the 0.9.x milestone Nov 29, 2016
@MeirionHughes
Copy link
Contributor

So it would seem nested templates are allowed on pretty all the container-type html elements; even table and select. But you need to have a template-controller on the template, otherwise nothing happens. I will have a run through to fix it all.

@MeirionHughes
Copy link
Contributor

I've temporarily added template as an allowed child of the html container elements; just a change of the default config to allow it. Comprehensive fix to be added in #142

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants