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_vdom
did not return the whole HTML model.Element
function 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 wrapperdiv
around 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
Element
function protocol typeThe
Element
functions signature was previously defined by aProtocol
with a__call__
attribute, however this didn't really work as expected.I wanted to enforce
(self: Element, *args: Any, **kwargs: Any)
where*args, **kwargs
was actually optional (i.e. functions conforming to the protocol could accept any, or no other arguments besidesself
).See python/mypy#5876 for details.