Closed zakjan closed 7 years ago
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).
Oh :( ok
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.
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.
https://gist.run/?id=33b8032f1c3236ed54cd80a5006c660e
As a sanity check; defo not working for me, even in chrome. :D
But if you add if.bind="true"
, it works :D Chrome
Works in firefox too... how odd.
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.
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.
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
template tag (or maybe even any containerless element) should be allowed