Dodrio support with a bespoke macro. #38
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This isn't very modular, but this PR adds a
dodrio!
macro behind a feature flag which bypasses the usualDOMTree
->VNode
-> native song and dance and generatesdodrio::builder
code directly in the macro.It still populates a
typed_html::elements
struct with attribute values so that we still have proper type checking, but instead of keeping these structs around in a full tree to be rendered later, the attributes are stringified on the spot and fed directly tododrio::builder::ElementBuilder
.Alas, event handlers all take
Event
rather than a refined type because that's all Dodrio's API allows for. On the bright side, because they all have the same type, there's no need to construct a giant event handler struct to type check them all, and we just bypass that bit entirely and pass the functions directly on to Dodrio without any further indirection.Testing has been sparse, but the basic "counter" example from Dodrio (in
examples/dodrio
) works.