Document fragments in template!
macro
#52
Labels
A-ergonomics
Area: API ergonomics
A-macro
Area: macros
C-bug
Category: bug, something isn't working
C-enhancement
Category: new feature or improvement to existing feature
Milestone
Describe the solution you'd like
The
template!
macro should allow document fragments without the<></>
JSX syntax.The following should be accepted by the
template!
macro:The
TemplateResult
struct should be converted into anenum
with the variantsSingle
andList
where the second variant is used for document fragments (including empty fragments). This should not use theDocumentFragment
under the hood as it behaves somewhat differently fromNode
s. For one thing, when appending aDocumentFragment
to the DOM, the elements are moved out of the fragment and no longer accessible. Instead,TemplateResult::List
should use aVec
or other collection under the hood.Questionnaire
Edit
The current way
Keyed
andIndexed
are a bit buggy. They returnDocumentFragment
s which, as described above, have certain differences from other html nodes. This results in a panic when updatingKeyed
andIndexed
at the top level of atemplate!
, e.g.The text was updated successfully, but these errors were encountered: