Misc changes + 0.4.2 version bump #56
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.
Summary
Fixes several things:
html_to_vdomdid not return the whole HTML model.Elementfunction signature.Return whole HTML model
If your html looked like this:
The function only returned the model for the first
div. Now it returns a wrapperdivaround both elements.Reworks how transform is applied
The transform was a little difficult to work with given the time at which it was applied. It's more intuitive for the transform to get applied from the root node to leafs rather than the other way around. It also makes the underlying code a little easier to reason about.
Fix
Elementfunction protocol typeThe
Elementfunctions signature was previously defined by aProtocolwith a__call__attribute, however this didn't really work as expected.I wanted to enforce
(self: Element, *args: Any, **kwargs: Any)where*args, **kwargswas actually optional (i.e. functions conforming to the protocol could accept any, or no other arguments besidesself).See python/mypy#5876 for details.